MCPcopy Index your code
hub / github.com/antlr/codebuff / orNaturalOrder

Method orNaturalOrder

output/java_guava/1.4.19/Maps.java:725–731  ·  view source on GitHub ↗

Returns the specified comparator if not null; otherwise returns Ordering.natural(). This method is an abomination of generics; the only purpose of this method is to contain the ugly type-casting in one place.

(@Nullable Comparator<? super E> comparator)

Source from the content-addressed store, hash-verified

723 */
724
725 @SuppressWarnings("unchecked")
726 static <E> Comparator<? super E> orNaturalOrder(@Nullable Comparator<? super E> comparator) {
727 if (comparator != null) { // can't use ? : because of javac bug 5080917
728 return comparator;
729 }
730 return (Comparator<E>) Ordering.natural();
731 }
732
733 /**
734 * Returns a live {@link Map} view whose keys are the contents of {@code set}

Callers 1

differenceMethod · 0.95

Calls 1

naturalMethod · 0.95

Tested by

no test coverage detected