Class SubscriptionList

java.lang.Object
rx.internal.util.SubscriptionList
All Implemented Interfaces:
Subscription

public final class SubscriptionList extends Object implements Subscription
Subscription that represents a group of Subscriptions that are unsubscribed together.
See Also:
  • Field Details

    • subscriptions

      private List<Subscription> subscriptions
    • unsubscribed

      private volatile boolean unsubscribed
  • Constructor Details

    • SubscriptionList

      public SubscriptionList()
      Constructs an empty SubscriptionList.
    • SubscriptionList

      public SubscriptionList(Subscription... subscriptions)
      Constructs a SubscriptionList with the given initial child subscriptions.
      Parameters:
      subscriptions - the array of subscriptions to start with
    • SubscriptionList

      public SubscriptionList(Subscription s)
      Constructs a SubscriptionList with the given initial child subscription.
      Parameters:
      s - the initial subscription instance
  • Method Details

    • isUnsubscribed

      public boolean isUnsubscribed()
      Description copied from interface: Subscription
      Indicates whether this Subscription is currently unsubscribed.
      Specified by:
      isUnsubscribed in interface Subscription
      Returns:
      true if this Subscription is currently unsubscribed, false otherwise
    • add

      public void add(Subscription s)
      Adds a new Subscription to this SubscriptionList if the SubscriptionList is not yet unsubscribed. If the SubscriptionList is unsubscribed, add will indicate this by explicitly unsubscribing the new Subscription as well.
      Parameters:
      s - the Subscription to add
    • remove

      public void remove(Subscription s)
    • unsubscribe

      public void unsubscribe()
      Unsubscribe from all of the subscriptions in the list, which stops the receipt of notifications on the associated Subscriber.
      Specified by:
      unsubscribe in interface Subscription
    • unsubscribeFromAll

      private static void unsubscribeFromAll(Collection<Subscription> subscriptions)
    • clear

      public void clear()
    • hasSubscriptions

      public boolean hasSubscriptions()
      Returns true if this composite is not unsubscribed and contains subscriptions.
      Returns:
      true if this composite is not unsubscribed and contains subscriptions.