gerrit/gerrit-gwtui-common
Dave Borowitz 6724990a32 Avoid Collections#sort
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
2018-09-05 09:53:01 -07:00
..
src Avoid Collections#sort 2018-09-05 09:53:01 -07:00
BUILD Dissolve gerrit-common top-level directory 2017-10-31 11:02:36 -04:00