From 2d5e45ba6f190edde76e08bef234c8b4cc936c9f Mon Sep 17 00:00:00 2001 From: Andrei Rybak Date: Wed, 13 Apr 2022 15:12:00 +0200 Subject: [PATCH] ReorderHabitsDialog: use Java 17 features --- .../andrybak/resoday/gui/edithabits/ReorderHabitsDialog.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/dev/andrybak/resoday/gui/edithabits/ReorderHabitsDialog.java b/src/main/java/dev/andrybak/resoday/gui/edithabits/ReorderHabitsDialog.java index da8c9c1..d9ce74c 100644 --- a/src/main/java/dev/andrybak/resoday/gui/edithabits/ReorderHabitsDialog.java +++ b/src/main/java/dev/andrybak/resoday/gui/edithabits/ReorderHabitsDialog.java @@ -304,10 +304,9 @@ private static class HabitListLayout implements LayoutManager2 { @Override public void addLayoutComponent(Component comp, Object constraints) { - if (!(constraints instanceof Column)) { + if (!(constraints instanceof Column column)) { return; } - Column column = ((Column)constraints); columns.computeIfAbsent(column, ignored -> new ArrayList<>()).add(comp); } @@ -341,7 +340,7 @@ public void layoutContainer(Container target) { throw new IllegalStateException("Column(s) " + columns.entrySet().stream() .filter(e -> e.getValue().isEmpty()) - .collect(toList()) + .toList() + " must not be empty"); } if (columns.values().stream().map(List::size).distinct().count() != 1) {