@Test public void testToImmutableMapDoesCopy() { Map<String, Integer> m = Maps.newHashMap(); m.put("a", 1); m.put("b", 2); assertThat(toImmutableMap(m), not(sameInstance(m))); assertThat(toImmutableMap(m), instanceOf(ImmutableMap.class)); }
public static <K, V> Map<K, V> toImmutableMap(Map<K, V> map) { if (map instanceof ImmutableMap) { return map; } return ImmutableMap.copyOf(map); }
CollectionUtil { public static <K, V> Map<K, V> toImmutableMap(Map<K, V> map) { if (map instanceof ImmutableMap) { return map; } return ImmutableMap.copyOf(map); } }
CollectionUtil { public static <K, V> Map<K, V> toImmutableMap(Map<K, V> map) { if (map instanceof ImmutableMap) { return map; } return ImmutableMap.copyOf(map); } private  CollectionUtil(); }
CollectionUtil { public static <K, V> Map<K, V> toImmutableMap(Map<K, V> map) { if (map instanceof ImmutableMap) { return map; } return ImmutableMap.copyOf(map); } private  CollectionUtil(); static Map<K, V> toImmutableMap(Map<K, V> map); static Map<K2, V2> toImmutableMap(
      Map<K1, V1> map,
      Function<Entry<K1, V1>, K2> keyFunction,
      Function<Entry<K1, V1>, V2> valueFunction); static Map<K2, V> toMap(
      Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction); static Map<K, V> toImmutableMap(
      Collection<E> set, Function<E, K> keyFunction, Function<E, V> valueFunction); static SortedMap<K2, V2> toImmutableSortedMap(
          Map<K1, V1> map,
          Function<Entry<K1, V1>, K2> keyFunction,
          Function<Entry<K1, V1>, V2> valueFunction); static Collector<T, ?, ImmutableSortedMap<K, V>> toImmutableSortedMap(
          Function<? super T, ? extends K> keyFunction,
          Function<? super T, ? extends V> valueFunction); static NavigableMap<K, V> toImmutableSortedMap(
      Collection<E> set, Function<E, K> keyFunction, Function<E, V> valueFunction); static Collector<T, ?, Integer> toOrderedHashCode(); static Collector<T, ?, Integer> toUnorderedHashCode(); static Collection<R> maxValues(Collection<R> values, Comparator<R> comparator); }
CollectionUtil { public static <K, V> Map<K, V> toImmutableMap(Map<K, V> map) { if (map instanceof ImmutableMap) { return map; } return ImmutableMap.copyOf(map); } private  CollectionUtil(); static Map<K, V> toImmutableMap(Map<K, V> map); static Map<K2, V2> toImmutableMap(
      Map<K1, V1> map,
      Function<Entry<K1, V1>, K2> keyFunction,
      Function<Entry<K1, V1>, V2> valueFunction); static Map<K2, V> toMap(
      Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction); static Map<K, V> toImmutableMap(
      Collection<E> set, Function<E, K> keyFunction, Function<E, V> valueFunction); static SortedMap<K2, V2> toImmutableSortedMap(
          Map<K1, V1> map,
          Function<Entry<K1, V1>, K2> keyFunction,
          Function<Entry<K1, V1>, V2> valueFunction); static Collector<T, ?, ImmutableSortedMap<K, V>> toImmutableSortedMap(
          Function<? super T, ? extends K> keyFunction,
          Function<? super T, ? extends V> valueFunction); static NavigableMap<K, V> toImmutableSortedMap(
      Collection<E> set, Function<E, K> keyFunction, Function<E, V> valueFunction); static Collector<T, ?, Integer> toOrderedHashCode(); static Collector<T, ?, Integer> toUnorderedHashCode(); static Collection<R> maxValues(Collection<R> values, Comparator<R> comparator);  }