android/guava/src/com/google/common/collect/Maps.java
@SuppressWarnings("unchecked")
  static <E> Comparator<? super E> orNaturalOrder(@NullableDecl Comparator<? super E> comparator) {
    if (comparator != null) { // can't use ? : because of javac bug 5080917
      return comparator;
    }
    return (Comparator<E>) Ordering.natural();
  }
@SuppressWarnings("unchecked")
  static <E> Comparator<? super E> orNaturalOrder(@NullableDecl Comparator<? super E> comparator) {
    if (comparator != null) { // can't use ? : because of javac bug 5080917
      return comparator;
    }
    return (Comparator<E>) Ordering.natural();
  }
@ SuppressWarnings ( "unchecked" ) static < E > Comparator < ? super E > orNaturalOrder ( @ NullableDecl Comparator < ? super E > comparator ) { if ( comparator != null ) { // can't use ? : because of javac bug 5080917 return comparator ; } return ( Comparator < E > ) Ordering . natural ( ) ; }
Returns the specified comparator if not null; otherwise returns {@code 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.
Returns the specified comparator if not null ; otherwise returns {