T - the value type unicastedpublic final class NbpUnicastSubject<T> extends NbpSubject<T,T>
This subject buffers notifications and replays them to the Subscriber as requested.
This subject holds an unbounded internal buffer.
If more than one Subscriber attempts to subscribe to this Subject, they will receive an IllegalStateException if this Subject hasn't terminated yet, or the Subscribers receive the terminal event (error or completion) if this Subject has terminated.
NbpObservable.NbpOnSubscribe<T>, NbpObservable.NbpOperator<Downstream,Upstream>, NbpObservable.NbpSubscriber<T>, NbpObservable.NbpTransformer<Upstream,Downstream>onSubscribe| Modifier | Constructor and Description |
|---|---|
protected |
NbpUnicastSubject(hu.akarnokd.rxjava2.subjects.nbp.NbpUnicastSubject.State<T> state)
Constructs the Observable base class.
|
| Modifier and Type | Method and Description |
|---|---|
static <T> NbpUnicastSubject<T> |
create()
Creates an UnicastSubject with an internal buffer capacity hint 16.
|
static <T> NbpUnicastSubject<T> |
create(int capacityHint)
Creates an UnicastSubject with the given internal buffer capacity hint.
|
static <T> NbpUnicastSubject<T> |
create(int capacityHint,
java.lang.Runnable onCancelled)
Creates an UnicastSubject with the given internal buffer capacity hint and a callback for
the case when the single Subscriber cancels its subscription.
|
java.lang.Throwable |
getThrowable()
Returns the error that caused the Subject to terminate or null if the Subject
hasn't terminated yet.
|
T |
getValue()
Returns a single value the Subject currently has or null if no such value exists.
|
T[] |
getValues(T[] array)
Returns a typed array containing a snapshot of all values of the Subject.
|
boolean |
hasComplete()
Returns true if the subject has reached a terminal state through a complete event.
|
boolean |
hasSubscribers()
Returns true if the subject has subscribers.
|
boolean |
hasThrowable()
Returns true if the subject has reached a terminal state through an error event.
|
boolean |
hasValue()
Returns true if the subject has any value.
|
void |
onComplete() |
void |
onError(java.lang.Throwable t) |
void |
onNext(T t) |
void |
onSubscribe(Disposable s) |
getValues, toSerializedall, amb, amb, ambWith, any, asObservable, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, buffer, cache, cache, cast, collect, collectInto, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, combineLatest, compose, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concat, concatArray, concatArray, concatMap, concatMap, concatMapIterable, concatMapIterable, concatWith, contains, count, create, debounce, debounce, debounce, defaultIfEmpty, defer, delay, delay, delay, delay, delay, delay, delaySubscription, delaySubscription, delaySubscription, delaySubscription, dematerialize, distinct, distinct, distinct, distinctUntilChanged, distinctUntilChanged, doOnCancel, doOnComplete, doOnEach, doOnEach, doOnError, doOnLifecycle, doOnNext, doOnSubscribe, doOnTerminate, elementAt, elementAt, empty, endWith, endWith, endWith, endWithArray, error, error, filter, finallyDo, first, first, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMap, flatMapIterable, flatMapIterable, flatMapIterable, forEach, forEachWhile, forEachWhile, forEachWhile, fromArray, fromCallable, fromFuture, fromFuture, fromFuture, fromFuture, fromIterable, fromPublisher, generate, generate, generate, generate, generate, getList, groupBy, groupBy, groupBy, groupBy, groupBy, ignoreElements, interval, interval, interval, interval, intervalRange, intervalRange, isEmpty, just, just, just, just, just, just, just, just, just, last, last, lift, map, materialize, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, merge, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeDelayError, mergeWith, nest, never, observeOn, observeOn, observeOn, ofType, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onErrorReturnValue, onExceptionResumeNext, publish, publish, publish, publish, range, reduce, reduce, reduceWith, repeat, repeat, repeatUntil, repeatWhen, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, replay, retry, retry, retry, retry, retry, retryUntil, retryWhen, safeSubscribe, sample, sample, sample, scan, scan, scanWith, sequenceEqual, sequenceEqual, sequenceEqual, sequenceEqual, serialize, share, single, single, skip, skip, skipLast, skipLast, skipLast, skipLast, skipLast, skipLast, skipUntil, skipWhile, startWith, startWith, startWith, startWithArray, subscribe, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, switchIfEmpty, switchMap, switchMap, switchOnNext, switchOnNext, take, take, takeFirst, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLast, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeLastBuffer, takeUntil, takeUntil, takeWhile, throttleFirst, throttleFirst, throttleLast, throttleLast, throttleWithTimeout, throttleWithTimeout, timeInterval, timeInterval, timeInterval, timeInterval, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timeout, timer, timer, timestamp, timestamp, timestamp, timestamp, to, toBlocking, toList, toList, toList, toMap, toMap, toMap, toMultimap, toMultimap, toMultimap, toMultimap, toObservable, toSingle, toSortedList, toSortedList, toSortedList, toSortedList, unsafeSubscribe, unsubscribeOn, using, using, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, window, withLatestFrom, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipArray, zipIterable, zipWith, zipWith, zipWith, zipWithprotected NbpUnicastSubject(hu.akarnokd.rxjava2.subjects.nbp.NbpUnicastSubject.State<T> state)
state - the subject statepublic static <T> NbpUnicastSubject<T> create()
T - the value typepublic static <T> NbpUnicastSubject<T> create(int capacityHint)
T - the value typecapacityHint - the hint to size the internal unbounded bufferpublic static <T> NbpUnicastSubject<T> create(int capacityHint, java.lang.Runnable onCancelled)
The callback, if not null, is called exactly once and non-overlapped with any active replay.
T - the value typecapacityHint - the hint to size the internal unbounded bufferonCancelled - the optional callbackpublic void onSubscribe(Disposable s)
public void onNext(T t)
public void onError(java.lang.Throwable t)
public void onComplete()
public boolean hasSubscribers()
NbpSubjectThe method is thread-safe.
hasSubscribers in class NbpSubject<T,T>public java.lang.Throwable getThrowable()
NbpSubjectThe method is thread-safe.
getThrowable in class NbpSubject<T,T>public boolean hasThrowable()
NbpSubjectThe method is thread-safe.
hasThrowable in class NbpSubject<T,T>&see {@link #hasComplete()}public boolean hasComplete()
NbpSubjectThe method is thread-safe.
hasComplete in class NbpSubject<T,T>NbpSubject.hasThrowable()public boolean hasValue()
NbpSubjectThe method is thread-safe.
hasValue in class NbpSubject<T,T>public T getValue()
NbpSubjectThe method is thread-safe.
getValue in class NbpSubject<T,T>public T[] getValues(T[] array)
NbpSubjectThe method follows the conventions of Collection.toArray by setting the array element after the last value to null (if the capacity permits).
The method is thread-safe.
getValues in class NbpSubject<T,T>array - the target array to copy values into if it fits