code: public static <T, K, A, D>
      Collector<T, ?, Map<K, D>> groupingBy(Function<? super T, ? extends K> classifier,
                                            Collector<? super T, A, D> downstream) {
          return groupingBy(classifier, HashMap::new, downstream);
      }
docs: Returns a {@code Collector} implementing a cascaded "group by" operation
  on input elements of type {@code T}, grouping elements according to a
  classification function, and then performing a reduction operation on
  the values associated with a given key using the specified downstream
  {@code Collector}.
  
  <p>The classification function maps elements to some key type {@code K}.
  The downstream collector operates on elements of type {@code T} and
  produces a result of type {@code D}. The resulting collector produces a
  {@code Map<K, D>}.
  
  <p>There are no guarantees on the type, mutability,
  serializability, or thread-safety of the {@code Map} returned.
  
  <p>For example, to compute the set of last names of people in each city:
  <pre>{@code
  Map<City, Set<String>> namesByCity
  = people.stream().collect(groupingBy(Person::getCity,
  mapping(Person::getLastName, toSet())));
  }</pre>
  
  @implNote
  The returned {@code Collector} is not concurrent.  For parallel stream
  pipelines, the {@code combiner} function operates by merging the keys
  from one map into another, which can be an expensive operation.  If
  preservation of the order in which elements are presented to the downstream
  collector is not required, using {@link #groupingByConcurrent(Function, Collector)}
  may offer better parallel performance.
  
  @param <T> the type of the input elements
  @param <K> the type of the keys
  @param <A> the intermediate accumulation type of the downstream collector
  @param <D> the result type of the downstream reduction
  @param classifier a classifier function mapping input elements to keys
  @param downstream a {@code Collector} implementing the downstream reduction
  @return a {@code Collector} implementing the cascaded group-by operation
  @see #groupingBy(Function)
  
  @see #groupingBy(Function, Supplier, Collector)
  @see #groupingByConcurrent(Function, Collector)