- Timestamp:
- 2021-04-30T21:52:45+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/data/notes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/notes/Note.java
r17712 r17837 53 53 54 54 /** Sorts notes by user, then creation date */ 55 public static final Comparator<Note> USER_COMPARATOR = (n1, n2) -> { 56 String n1User = n1.getFirstComment().getUser().getName(); 57 String n2User = n2.getFirstComment().getUser().getName(); 58 return n1User.equals(n2User) ? DATE_COMPARATOR.compare(n1, n2) : n1User.compareTo(n2User); 59 }; 55 public static final Comparator<Note> USER_COMPARATOR = 56 Comparator.comparing(Note::getUserName, Comparator.nullsLast(Comparator.naturalOrder())).thenComparing(DATE_COMPARATOR); 60 57 61 58 /** Sorts notes by the last modified date */ 62 public static final Comparator<Note> LAST_ACTION_COMPARATOR = 63 (n1, n2) -> NoteComment.DATE_COMPARATOR.compare(n1.getLastComment(), n2.getLastComment()); 59 public static final Comparator<Note> LAST_ACTION_COMPARATOR = Comparator.comparing(Note::getLastComment, NoteComment.DATE_COMPARATOR); 64 60 65 61 private long id; … … 181 177 public NoteComment getFirstComment() { 182 178 return comments.isEmpty() ? null : comments.get(0); 179 } 180 181 private String getUserName() { 182 return getFirstComment() == null ? null : getFirstComment().getUser().getName(); 183 183 } 184 184 -
trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java
r17712 r17837 40 40 41 41 /** Sorts note comments strictly by creation date */ 42 public static final Comparator<NoteComment> DATE_COMPARATOR = Comparator. comparing(n -> n.commentTimestamp);42 public static final Comparator<NoteComment> DATE_COMPARATOR = Comparator.nullsLast(Comparator.comparing(n -> n.commentTimestamp)); 43 43 44 44 /**
Note:
See TracChangeset
for help on using the changeset viewer.