Skip to content

Commit

Permalink
Make null sortable
Browse files Browse the repository at this point in the history
  • Loading branch information
mitosagi committed Apr 5, 2020
1 parent 5653d44 commit 4491b66
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,19 @@ private static List<PlaylistLocalItem> merge(
items.addAll(localPlaylists);
items.addAll(remotePlaylists);

Collections.sort(items, (left, right) ->
left.getOrderingName().compareToIgnoreCase(right.getOrderingName()));
Collections.sort(items, (left, right) -> {
String on1 = left.getOrderingName();
String on2 = right.getOrderingName();
if (on1 == null && on2 == null) {
return 0;
} else if (on1 != null && on2 == null) {
return -1;
} else if (on1 == null && on2 != null) {
return 1;
} else {
return on1.compareToIgnoreCase(on2);
}
});

return items;
}
Expand Down

0 comments on commit 4491b66

Please sign in to comment.