code: public <K, V> Stream<Grouped<K, V>> groupBy(final Func1<? super T, ? extends K> groupSelector, final Func1<? super T, ? extends V> valueSelector) {
          return new Stream<Grouped<K, V>>() {
              @Override
              public Iterator<Grouped<K, V>> iterator() {
                  List<K> keys = new ArrayList<>();
                  final Map<K, ArrayList<V>> map = new HashMap<>();
                  for (T item : Stream.this) {
                      K key = groupSelector.call(item);
                      ArrayList<V> list = map.get(key);
                      if (list == null) {
                          keys.add(key);
                          map.put(key, list = new ArrayList<>());
                      }
                      list.add(valueSelector.call(item));
                  }
                  return stream(keys)
                      .map(new Func1<K, Grouped<K, V>>() {
                          @Override
                          public Grouped<K, V> call(K key) {
                              return new Grouped<>(key, stream(map.get(key)));
                          }
                      })
                      .iterator();
              }
          };
      }
docs: Returns a new stream of {@link Grouped} that is composed from keys and values that has been
  extracted from each source stream item.
  
  @param groupSelector a function that extracts a key from a given item.
  @param valueSelector a function that extracts a value from a given item.
  @param <K>           a type of key value.
  @return a new stream of {@link Grouped} that is grouped by a key extracted from each source stream item.