code: public Map<K, V> toMap() {
          Map<K, V> map = isParallel() ? new ConcurrentHashMap<>() : new HashMap<>();
          forEach(toMapConsumer(map));
          return map;
      }
docs: Returns a {@link Map} containing the elements of this stream. There are
  no guarantees on the type or serializability of the {@code Map} returned;
  if more control over the returned {@code Map} is required, use
  {@link #toCustomMap(Supplier)}.
  
  <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.
  
  @return a {@code Map} containing the elements of this stream
  @throws IllegalStateException if this stream contains duplicate keys
  (according to {@link Object#equals(Object)})
  @see Collectors#toMap(Function, Function)
  @see Collectors#toConcurrentMap(Function, Function)
  @see #toImmutableMap()