6724990a32
With the introduction of default methods in Java 8, Java finally grew a List#sort method that can be used in place of the static Collections#sort. Convert simple in-place sorts that need to be in-place sorts to use this method where possible. During the course of this change, it became obvious that many instances of sort were just sorting a newly-created ArrayList in place. These can be replaced with more idiomatic Stream constructions, sometimes even eliminating a loop to populate the list. One difference between List#sort and Collections#sort is there is no List#sort() with no arguments; callers must always pass either naturalOrder() or a null comparators. In this change, there were so few remaining instances of sorting by natural order that typing naturalOrder() didn't seem too repetitious, and it is quite readable. Change-Id: I4d89421a72127e9a36cbd32aeac425c0471a1b3f |
||
---|---|---|
.. | ||
main | ||
test/java/com/google/gerrit/client |