public final class Disposables extends Object
Disposable
sub-interfaces (Disposable.Composite
,
Disposable.Swap
).Modifier and Type | Method and Description |
---|---|
static Disposable.Composite |
composite()
Create a new empty
Disposable.Composite with atomic guarantees on all mutative
operations. |
static Disposable.Composite |
composite(Disposable... disposables)
Create and initialize a new
Disposable.Composite with atomic guarantees on
all mutative operations. |
static Disposable.Composite |
composite(Iterable<? extends Disposable> disposables)
Create and initialize a new
Disposable.Composite with atomic guarantees on
all mutative operations. |
static Disposable |
disposed()
Return a new
Disposable that is already disposed. |
static Disposable |
never()
Return a new
Disposable that can never be disposed. |
static Disposable |
single()
Return a new simple
Disposable instance that is initially not disposed but
can be by calling Disposable.dispose() . |
static Disposable.Swap |
swap()
Create a new empty
Disposable.Swap with atomic guarantees on all mutative
operations. |
public static Disposable.Composite composite()
Disposable.Composite
with atomic guarantees on all mutative
operations.Disposable.Composite
public static Disposable.Composite composite(Disposable... disposables)
Disposable.Composite
with atomic guarantees on
all mutative operations.Disposable.Composite
public static Disposable.Composite composite(Iterable<? extends Disposable> disposables)
Disposable.Composite
with atomic guarantees on
all mutative operations.Disposable.Composite
public static Disposable disposed()
Disposable
that is already disposed.Disposable
.public static Disposable never()
Disposable
that can never be disposed. Calling Disposable.dispose()
is a NO-OP and Disposable.isDisposed()
always return false.Disposable
that can never be disposed.public static Disposable single()
Disposable
instance that is initially not disposed but
can be by calling Disposable.dispose()
.Disposable
initially not yet disposed.public static Disposable.Swap swap()
Disposable.Swap
with atomic guarantees on all mutative
operations.Disposable.Swap