src/main/java/io/reactivex/Flowable.java
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.FULL)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <K, V> Flowable<GroupedFlowable<K, V>> groupBy(Function<? super T, ? extends K> keySelector,
            Function<? super T, ? extends V> valueSelector) {
        return groupBy(keySelector, valueSelector, false, bufferSize());
    }
@CheckReturnValue
    @BackpressureSupport(BackpressureKind.FULL)
    @SchedulerSupport(SchedulerSupport.NONE)
    public final <K, V> Flowable<GroupedFlowable<K, V>> groupBy(Function<? super T, ? extends K> keySelector,
            Function<? super T, ? extends V> valueSelector) {
        return groupBy(keySelector, valueSelector, false, bufferSize());
    }
Groups the items emitted by a {@code Publisher} according to a specified criterion, and emits these
grouped items as {@link GroupedFlowable}s. The emitted {@code GroupedPublisher} allows only a single
{@link Subscriber} during its lifetime and if this {@code Subscriber} cancels before the
source terminates, the next emission by the source having the same key will trigger a new
{@code GroupedPublisher} emission.
<p>
<img width="640" height="360" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/groupBy.png" alt="">
<p>
<em>Note:</em> A {@link GroupedFlowable} will cache the items it is to emit until such time as it
is subscribed to. For this reason, in order to avoid memory leaks, you should not simply ignore those
{@code GroupedPublisher}s that do not concern you. Instead, you can signal to them that they may
discard their buffers by applying an operator like {@link #ignoreElements} to them.
<p>
Note that the {@link GroupedFlowable}s should be subscribed to as soon as possible, otherwise,
the unconsumed groups may starve other groups due to the internal backpressure
coordination of the {@code groupBy} operator. Such hangs can be usually avoided by using
{@link #flatMap(Function, int)} or {@link #concatMapEager(Function, int, int)} and overriding the default maximum concurrency
value to be greater or equal to the expected number of groups, possibly using
{@code Integer.MAX_VALUE} if the number of expected groups is unknown.

<dl>
<dt><b>Backpressure:</b></dt>
<dd>Both the returned and its inner {@code Publisher}s honor backpressure and the source {@code Publisher}
is consumed in a bounded mode (i.e., requested a fixed amount upfront and replenished based on
downstream consumption). Note that both the returned and its inner {@code Publisher}s use
unbounded internal buffers and if the source {@code Publisher} doesn't honor backpressure, that <em>may</em>
lead to {@code OutOfMemoryError}.</dd>
<dt><b>Scheduler:</b></dt>
<dd>{@code groupBy} does not operate by default on a particular {@link Scheduler}.</dd>
</dl>

@param keySelector
a function that extracts the key for each item
@param valueSelector
a function that extracts the return element for each item
@param <K>
the key type
@param <V>
the element type
@return a {@code Publisher} that emits {@link GroupedFlowable}s, each of which corresponds to a
unique key value and each of which emits those items from the source Publisher that share that
key value
@see <a href="http://reactivex.io/documentation/operators/groupby.html">ReactiveX operators documentation: GroupBy</a>