hu.akarnokd.rxjava2.subjects

## Class SingleSubject<T>

- java.lang.Object
- - io.reactivex.Single<T>
  - - hu.akarnokd.rxjava2.subjects.SingleSubject<T>

Type Parameters:
  `T` - the value type received and emitted

All Implemented Interfaces:
  io.reactivex.SingleObserver<T>, io.reactivex.SingleSource<T>

    public final class SingleSubject<T>
    extends io.reactivex.Single<T>
    implements io.reactivex.SingleObserver<T>

Represents a hot Single-like source and consumer of events similar to Subjects.

All methods are thread safe. Calling onSuccess multiple times has no effect. Calling onError multiple times relays the Throwable to the RxJavaPlugins' error handler.

The SingleSubject doesn't store the Disposables coming through onSubscribe but disposes them once the other onXXX methods were called (terminal state reached).

### Method Summary

All Methods Static Methods Instance Methods Concrete Methods
`static <T> SingleSubject<T>` `create()` Creates a fresh SingleSubject.
`java.lang.Throwable` `getThrowable()` Returns the terminal error if this SingleSubject has been terminated with an error, null otherwise.
`T` `getValue()` Returns the success value if this SingleSubject was terminated with a success value.
`boolean` `hasObservers()` Returns true if this SingleSubject has observers.
`boolean` `hasThrowable()` Returns true if this SingleSubject has been terminated with an error.
`boolean` `hasValue()` Returns true if this SingleSubject was terminated with a success value.
`void` `onError(java.lang.Throwable e)`
`void` `onSubscribe(io.reactivex.disposables.Disposable d)`
`void` `onSuccess(T value)`
`protected void` `subscribeActual(io.reactivex.SingleObserver<? super T> observer)`

### Methods inherited from class io.reactivex.Single

`amb, ambArray, ambWith, blockingGet, cache, cast, compose, concat, concat, concat, concat, concat, concat, concat, concatArray, concatWith, contains, contains, create, defer, delay, delay, delaySubscription, delaySubscription, delaySubscription, delaySubscription, delaySubscription, delaySubscription, doAfterSuccess, doFinally, doOnDispose, doOnError, doOnEvent, doOnSubscribe, doOnSuccess, equals, error, error, filter, flatMap, flatMapCompletable, flatMapMaybe, flatMapObservable, flatMapPublisher, flattenAsFlowable, flattenAsObservable, fromCallable, fromFuture, fromFuture, fromFuture, fromFuture, fromObservable, fromPublisher, hide, just, lift, map, merge, merge, merge, merge, merge, merge, mergeWith, never, observeOn, onErrorResumeNext, onErrorResumeNext, onErrorReturn, onErrorReturnItem, repeat, repeat, repeatUntil, repeatWhen, retry, retry, retry, retry, retryWhen, subscribe, subscribe, subscribe, subscribe, subscribe, subscribeOn, subscribeWith, takeUntil, takeUntil, takeUntil, test, test, timeout, timeout, timeout, timeout, timer, timer, to, toCompletable, toFlowable, toFuture, toMaybe, toObservable, unsafeCreate, using, using, wrap, zip, zip, zip, zip, zip, zip, zip, zip, zip, zipArray, zipWith`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### create

    public static <T> SingleSubject<T> create()

Creates a fresh SingleSubject.

Type Parameters:
  `T` - the value type received and emitted
Returns:
  the new SingleSubject instance

#### onSubscribe

    public void onSubscribe(io.reactivex.disposables.Disposable d)

Specified by:
  `onSubscribe` in interface `io.reactivex.SingleObserver<T>`

#### onSuccess

    public void onSuccess(T value)

Specified by:
  `onSuccess` in interface `io.reactivex.SingleObserver<T>`

#### onError

    public void onError(java.lang.Throwable e)

Specified by:
  `onError` in interface `io.reactivex.SingleObserver<T>`

#### subscribeActual

    protected void subscribeActual(io.reactivex.SingleObserver<? super T> observer)

Specified by:
  `subscribeActual` in class `io.reactivex.Single<T>`

#### getValue

    public T getValue()

Returns the success value if this SingleSubject was terminated with a success value.

Returns:
  the success value or null

#### hasValue

    public boolean hasValue()

Returns true if this SingleSubject was terminated with a success value.

Returns:
  true if this SingleSubject was terminated with a success value

#### getThrowable

    public java.lang.Throwable getThrowable()

Returns the terminal error if this SingleSubject has been terminated with an error, null otherwise.

Returns:
  the terminal error or null if not terminated or not with an error

#### hasThrowable

    public boolean hasThrowable()

Returns true if this SingleSubject has been terminated with an error.

Returns:
  true if this SingleSubject has been terminated with an error

#### hasObservers

    public boolean hasObservers()

Returns true if this SingleSubject has observers.

Returns:
  true if this SingleSubject has observers