Top Description Fields Constructors Methods
rx.observables

public Class GroupedObservable<K, T>

extends Observable<T>
Class Inheritance
Known Direct Subclasses
rx.internal.operators.OperatorGroupBy.GroupedUnicast, rx.internal.operators.OperatorGroupByEvicting.GroupedUnicast
Type Parameters
<K>
the type of the key
<T>
the type of the items emitted by the GroupedObservable
Imports
rx.Observable, .Scheduler, .Subscriber, rx.functions.Func1

An Observable that has been grouped by key, the value of which can be obtained with getKey().

Note

A GroupedObservable 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 GroupedObservables that do not concern you. Instead, you can signal to them that they may discard their buffers by applying an operator like take(0) to them.

See Also
Observable#groupBy(Func1), ReactiveX documentation: GroupBy

Field Summary

Modifier and TypeField and Description
private final K

Constructor Summary

AccessConstructor and Description
protected
GroupedObservable(K key, Observable.OnSubscribe<T> onSubscribe)

Method Summary

Modifier and TypeMethod and Description
public static <
the type of the key
K
,
the type of the items that this Observable emits
T
>
GroupedObservable<K, T>

Returns:

a GroupedObservable that, when a Subscriber subscribes to it, will execute the specified function
create
(K
the key value
key
,
Observable.OnSubscribe<T>
a function that accepts an Subscriber<T>, and invokes its onNext, onError, and onCompleted methods as appropriate
f
)

Returns an Observable that will execute the specified function when a Subscriber subscribes to it.

public static <
the key type
K
,
the value type
T
>
GroupedObservable<K, T>

Returns:

a GroupedObservable representation of o, with key key
from
(K
the key to identify the group of items emitted by this GroupedObservable
key
,
final Observable<T>
the Observable to convert
o
)

Converts an Observable into a GroupedObservable with a particular key.

public K

Returns:

the key that the items emitted by this GroupedObservable were grouped by
getKey
()

Returns the key that identifies the group of items emitted by this GroupedObservable

Inherited from rx.Observable:
allambambambambambambambambambambWithasObservablebufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbufferbuffercachecachecacheWithInitialCapacitycastcollectcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestcombineLatestDelayErrorcomposeconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatDelayErrorconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatEagerconcatMapconcatMapDelayErrorconcatMapEagerconcatMapEagerconcatMapEagerconcatMapIterableconcatWithcontainscountcountLongcreatecreatecreatecreatedebouncedebouncedebouncedefaultIfEmptydeferdelaydelaydelaydelaydelaySubscriptiondelaySubscriptiondelaySubscriptiondelaySubscriptiondematerializedistinctdistinctdistinctUntilChangeddistinctUntilChangeddistinctUntilChangeddoAfterTerminatedoOnCompleteddoOnEachdoOnEachdoOnErrordoOnNextdoOnRequestdoOnSubscribedoOnTerminatedoOnUnsubscribeelementAtelementAtOrDefaultemptyerrorexistsfilterfinallyDofirstfirstfirstOrDefaultfirstOrDefaultflatMapflatMapflatMapflatMapflatMapflatMapflatMapCompletableflatMapCompletableflatMapCompletableflatMapIterableflatMapIterableflatMapIterableflatMapIterableflatMapSingleflatMapSingleflatMapSingleforEachforEachforEachfromfromfromfromfromfromCallablegroupBygroupBygroupBygroupBygroupJoinignoreElementsintervalintervalintervalintervalisEmptyjoinjustjustjustjustjustjustjustjustjustjustlastlastlastOrDefaultlastOrDefaultliftlimitmapmaterializemergemergemergemergemergemergemergemergemergemergemergemergemergemergemergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeDelayErrormergeWithnestneverobserveOnobserveOnobserveOnobserveOnofTypeonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureBufferonBackpressureDroponBackpressureDroponBackpressureLatestonErrorResumeNextonErrorResumeNextonErrorReturnonExceptionResumeNextonTerminateDetachpublishpublishrangerangerebatchRequestsreducereducerepeatrepeatrepeatrepeatrepeatWhenrepeatWhenreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayreplayretryretryretryretryWhenretryWhensamplesamplesamplescanscansequenceEqualsequenceEqualserializesharesinglesinglesingleOrDefaultsingleOrDefaultskipskipskipskipLastskipLastskipLastskipUntilskipWhilesortedsortedstartWithstartWithstartWithstartWithstartWithstartWithstartWithstartWithstartWithstartWithstartWithsubscribesubscribesubscribesubscribesubscribesubscribesubscribeOnsubscribeOnswitchIfEmptyswitchMapswitchMapDelayErrorswitchOnNextswitchOnNextDelayErrortaketaketaketakeFirsttakeLasttakeLasttakeLasttakeLasttakeLasttakeLastBuffertakeLastBuffertakeLastBuffertakeLastBuffertakeLastBuffertakeUntiltakeUntiltakeWhiletesttestthrottleFirstthrottleFirstthrottleLastthrottleLastthrottleWithTimeoutthrottleWithTimeouttimeIntervaltimeIntervaltimeouttimeouttimeouttimeouttimeouttimeouttimeouttimeouttimertimertimertimertimestamptimestamptotoBlockingtoCompletabletoListtoMaptoMaptoMaptoMultimaptoMultimaptoMultimaptoMultimaptoSingletoSortedListtoSortedListtoSortedListtoSortedListunsafeCreateunsafeSubscribeunsubscribeOnusingusingwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwindowwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromwithLatestFromzipzipzipzipzipzipzipzipzipzipzipzipWithzipWith

Field Detail

keyback to summary
private final K key

Constructor Detail

GroupedObservableback to summary
protected GroupedObservable(K key, Observable.OnSubscribe<T> onSubscribe)

Method Detail

createback to summary
public static <K, T> GroupedObservable<K, T> create(K key, Observable.OnSubscribe<T> f)

Returns an Observable that will execute the specified function when a Subscriber subscribes to it.

Write the function you pass to create so that it behaves as an Observable: It should invoke the Subscriber's onNext, onError, and onCompleted methods appropriately.

A well-formed Observable must invoke either the Subscriber's onCompleted method exactly once or its onError method exactly once.

See Rx Design Guidelines (PDF) for detailed information.

Scheduler:
create does not operate by default on a particular Scheduler.
Parameters
<K>
the type of the key
<T>
the type of the items that this Observable emits
key:K

the key value

f:Observable.OnSubscribe<T>

a function that accepts an Subscriber<T>, and invokes its onNext, onError, and onCompleted methods as appropriate

Returns:GroupedObservable<K, T>

a GroupedObservable that, when a Subscriber subscribes to it, will execute the specified function

fromback to summary
public static <K, T> GroupedObservable<K, T> from(K key, final Observable<T> o)

Converts an Observable into a GroupedObservable with a particular key.

Parameters
<K>
the key type
<T>
the value type
key:K

the key to identify the group of items emitted by this GroupedObservable

o:Observable<T>

the Observable to convert

Returns:GroupedObservable<K, T>

a GroupedObservable representation of o, with key key

getKeyback to summary
public K getKey()

Returns the key that identifies the group of items emitted by this GroupedObservable

Returns:K

the key that the items emitted by this GroupedObservable were grouped by