code: public <K, V> Map<K, V> toMap(Function<? super T, ? extends K> keyMapper, Function<? super T, ? extends V> valMapper) {
          Map<K, V> map = isParallel() ? new ConcurrentHashMap<>() : new HashMap<>();
          return toMapThrowing(keyMapper, valMapper, map);
      }
docs: Returns a {@link Map} whose keys and values are the result of applying
  the provided mapping functions to the input elements.
  
  <p>
  This is a <a href="package-summary.html#StreamOps">terminal</a>
  operation.
  
  <p>
  Returned {@code Map} is guaranteed to be modifiable.
  
  <p>
  For parallel stream the concurrent {@code Map} is created.
  
  @param <K> the output type of the key mapping function
  @param <V> the output type of the value mapping function
  @param keyMapper a mapping function to produce keys
  @param valMapper a mapping function to produce values
  @return a {@code Map} whose keys and values are the result of applying
  mapping functions to the input elements
  @throws IllegalStateException if duplicate mapped key is found (according
  to {@link Object#equals(Object)})
  
  @see Collectors#toMap(Function, Function)
  @see Collectors#toConcurrentMap(Function, Function)
  @see #toMap(Function)