Skip to content

Commit

Permalink
ReorderHabitsDialog: use Java 17 features
Browse files Browse the repository at this point in the history
  • Loading branch information
rybak committed Apr 13, 2022
1 parent 90c6572 commit 2d5e45b
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 2d5e45b

Please sign in to comment.