code: public <M extends Map<K, V>> M toCustomMap(Supplier<M> mapSupplier) {
          M map = mapSupplier.get();
          if (isParallel() && !(map instanceof ConcurrentMap)) {
              return collect(mapSupplier, (m, t) -> addToMap(m, t.getKey(), Objects.requireNonNull(t.getValue())), (m1,
                      m2) -> m2.forEach((k, v) -> addToMap(m1, k, v)));
          }
          forEach(toMapConsumer(map));
          return map;
      }
docs: Returns a {@link Map} containing the elements of this stream. The
  {@code Map} is created by a provided supplier function.
  
  <p>
  This is a <a href="package-summary.html#StreamOps">terminal</a>
  operation.
  
  @param <M> the type of the resulting map
  @param mapSupplier a function which returns a new, empty {@code Map} into
  which the results will be inserted
  @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)