Interface DisposableContainer

All Superinterfaces:
Disposable
All Known Implementing Classes:
CompositeDisposable

public interface DisposableContainer extends Disposable
Common interface to add and remove Disposables from a container.
Since:
2.0
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Adds a disposable to this container or disposes it if the container has been disposed.
    void
    Removes and disposes all contained Disposables, making this container fresh without disposing the entire container.
    boolean
    Removes but does not dispose the given disposable if it is part of this container.
    boolean
    Removes and disposes the given disposable if it is part of this container.
    void
    Removes all contained Disposables without disposing them, making this container fresh.

    Methods inherited from interface Disposable

    asAutoCloseable, dispose, isDisposed
    Modifier and Type
    Method
    Description
    Wraps this Disposable into an AutoCloseable instance that can be used with try-with-resources constructs.
    void
    Dispose the resource, the operation should be idempotent.
    boolean
    Returns true if this resource has been disposed.
  • Method Details

    • add

      boolean add(@NonNull @NonNull Disposable d)
      Adds a disposable to this container or disposes it if the container has been disposed.
      Parameters:
      d - the disposable to add, not null
      Returns:
      true if successful, false if this container has been disposed
    • remove

      boolean remove(@NonNull @NonNull Disposable d)
      Removes and disposes the given disposable if it is part of this container.
      Parameters:
      d - the disposable to remove and dispose, not null
      Returns:
      true if the operation was successful
    • delete

      boolean delete(@NonNull @NonNull Disposable d)
      Removes but does not dispose the given disposable if it is part of this container.
      Parameters:
      d - the disposable to remove, not null
      Returns:
      true if the operation was successful
    • reset

      void reset()
      Removes all contained Disposables without disposing them, making this container fresh.
      Since:
      4.0.0
    • clear

      void clear()
      Removes and disposes all contained Disposables, making this container fresh without disposing the entire container.