code: public static <T, K extends Enum<K>, V> Collector<T, ?, ImmutableMap<K, V>> toImmutableEnumMap(
        java.util.function.Function<? super T, ? extends K> keyFunction,
        java.util.function.Function<? super T, ? extends V> valueFunction) {
      checkNotNull(keyFunction);
      checkNotNull(valueFunction);
      return Collector.of(
          () ->
              new Accumulator<K, V>(
                  (v1, v2) -> {
                    throw new IllegalArgumentException("Multiple values for key: " + v1 + ", " + v2);
                  }),
          (accum, t) -> {
            K key = checkNotNull(keyFunction.apply(t), "Null key for input %s", t);
            V newValue = checkNotNull(valueFunction.apply(t), "Null value for input %s", t);
            accum.put(key, newValue);
          },
          Accumulator::combine,
          Accumulator::toImmutableMap,
          Collector.Characteristics.UNORDERED);
    }
docs: Returns a {@link Collector} that accumulates elements into an {@code ImmutableMap} whose keys
  and values are the result of applying the provided mapping functions to the input elements. The
  resulting implementation is specialized for enum key types. The returned map and its views will
  iterate over keys in their enum definition order, not encounter order.
  
  <p>If the mapped keys contain duplicates, an {@code IllegalArgumentException} is thrown when
  the collection operation is performed. (This differs from the {@code Collector} returned by
  {@link java.util.stream.Collectors#toMap(java.util.function.Function,
  java.util.function.Function) Collectors.toMap(Function, Function)}, which throws an {@code
  IllegalStateException}.)
  
  @since 21.0