android/guava/src/com/google/common/collect/ImmutableSortedMap.java
public static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
    // Hack around K not being a subtype of Comparable.
    // Unsafe, see ImmutableSortedSetFauxverideShim.
    @SuppressWarnings("unchecked")
    Ordering<K> naturalOrder = (Ordering<K>) NATURAL_ORDER;
    return copyOfInternal(map, naturalOrder);
  }
public static <K, V> ImmutableSortedMap<K, V> copyOf(Map<? extends K, ? extends V> map) {
    // Hack around K not being a subtype of Comparable.
    // Unsafe, see ImmutableSortedSetFauxverideShim.
    @SuppressWarnings("unchecked")
    Ordering<K> naturalOrder = (Ordering<K>) NATURAL_ORDER;
    return copyOfInternal(map, naturalOrder);
  }
Returns an immutable map containing the same entries as {@code map}, sorted by the natural
ordering of the keys.

<p>Despite the method name, this method attempts to avoid actually copying the data when it is
safe to do so. The exact circumstances under which a copy will or will not be performed are
undocumented and subject to change.

<p>This method is not type-safe, as it may be called on a map with keys that are not mutually
comparable.

@throws ClassCastException if the keys in {@code map} are not mutually comparable
@throws NullPointerException if any key or value in {@code map} is null
@throws IllegalArgumentException if any two keys are equal according to their natural ordering