gerrit/java/com/google/gerrit/server/patch
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
..
AutoMerger.java Annotate some of the methods/types that are public for external use 2018-07-06 08:39:42 +02:00
CharText.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
CharTextComparator.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
ComparisonType.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
DiffExecutor.java Dissolve gerrit-server top-level directory 2017-10-31 11:02:38 -04:00
DiffExecutorModule.java Support copying logging context to background threads 2018-08-14 08:21:04 +02:00
DiffSummary.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
DiffSummaryKey.java Merge branch 'stable-2.15' 2018-04-04 10:27:36 +02:00
DiffSummaryLoader.java Avoid Collections#sort 2018-09-05 09:53:01 -07:00
DiffSummaryWeigher.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
EditTransformer.java Merge branch 'stable-2.15' 2018-04-04 10:27:36 +02:00
IntraLineDiff.java Merge branch 'stable-2.15' 2017-12-15 19:11:51 +09:00
IntraLineDiffArgs.java Merge branch 'stable-2.15' 2018-04-04 10:27:36 +02:00
IntraLineDiffKey.java Prevent corruption of PatchListEntry 2018-07-20 17:16:47 +02:00
IntraLineLoader.java Reformat all Java files with google-java-format 1.6 2018-06-06 10:26:51 +09:00
IntraLineWeigher.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
MergeListBuilder.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
PatchFile.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
PatchList.java Convert simple anonymous Comparators to comparing() 2018-08-31 08:47:32 -07:00
PatchListCache.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
PatchListCacheImpl.java Migrate server classes to Flogger 2018-06-05 13:06:05 +02:00
PatchListEntry.java Prevent corruption of PatchListEntry 2018-07-20 17:16:47 +02:00
PatchListKey.java Prevent corruption of PatchListEntry 2018-07-20 17:16:47 +02:00
PatchListLoader.java Reformat all Java files with google-java-format 1.6 2018-06-06 10:26:51 +09:00
PatchListNotAvailableException.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
PatchListObjectTooLargeException.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
PatchListWeigher.java Revert "Split off library classes from server/patch/ into diff/" 2017-11-17 10:03:00 +00:00
PatchScriptBuilder.java Avoid Collections#sort 2018-09-05 09:53:01 -07:00
PatchScriptFactory.java Migrate server classes to Flogger 2018-06-05 13:06:05 +02:00
PatchSetInfoFactory.java Dissolve gerrit-server top-level directory 2017-10-31 11:02:38 -04:00
PatchSetInfoNotAvailableException.java Dissolve gerrit-server top-level directory 2017-10-31 11:02:38 -04:00
Text.java Migrate server classes to Flogger 2018-06-05 13:06:05 +02:00