We can use method references within ReviewDbUtil to cut down on some
code. However, going through usages didn't show a uniform benefit to
using native Java 8 Comparator constructs. The naive replacement:
comparing(Change.Id::get)
is shorter and more readable when it's correct, but it's not always
correct in the presence of nulls.
Ordering is also probably not going away from Guava, as it provides
some handy methods that are not (yet?) present on Comparator. For
example, creating a sorted copy of a Collection with Comparator is
arguably readable, but is not exactly short:
myList.stream().sorted(comparing(Change.Id::get)).collect(toList())
Compared with the Ordering alernative:
ReviewDbUtil.intKeyOrdering().sortedCopy(myList)
This benefit is greater when dealing with Iterable, which does not
have a readily available stream() method.
Leave some guidance in the intKeyOrdering Javadoc with advice.
Change-Id: Ib645abf060302cfc1c6d83f691e94f1dbf7c6db5