@Test public void testToMap() { Set<String> m = ImmutableSet.of("a", "b"); assertThat( toMap(m, Function.identity(), x -> x.equals("a") ? 0 : 1), equalTo(ImmutableMap.of("a", 0, "b", 1))); }
public static <K1, K2, V> Map<K2, V> toMap( Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction) { return set.stream().collect(Collectors.toMap(keyFunction, valueFunction)); }
CollectionUtil { public static <K1, K2, V> Map<K2, V> toMap( Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction) { return set.stream().collect(Collectors.toMap(keyFunction, valueFunction)); } }
CollectionUtil { public static <K1, K2, V> Map<K2, V> toMap( Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction) { return set.stream().collect(Collectors.toMap(keyFunction, valueFunction)); } private  CollectionUtil(); }
CollectionUtil { public static <K1, K2, V> Map<K2, V> toMap( Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction) { return set.stream().collect(Collectors.toMap(keyFunction, valueFunction)); } 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 <K1, K2, V> Map<K2, V> toMap( Set<K1> set, Function<K1, K2> keyFunction, Function<K1, V> valueFunction) { return set.stream().collect(Collectors.toMap(keyFunction, valueFunction)); } 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);  }