Package rx.internal.util
Class SubscriptionList
- java.lang.Object
-
- rx.internal.util.SubscriptionList
-
- All Implemented Interfaces:
Subscription
public final class SubscriptionList extends java.lang.Object implements Subscription
Subscription that represents a group of Subscriptions that are unsubscribed together.- See Also:
- Rx.Net equivalent CompositeDisposable
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<Subscription>subscriptionsprivate booleanunsubscribed
-
Constructor Summary
Constructors Constructor Description SubscriptionList()Constructs an empty SubscriptionList.SubscriptionList(Subscription s)Constructs a SubscriptionList with the given initial child subscription.SubscriptionList(Subscription... subscriptions)Constructs a SubscriptionList with the given initial child subscriptions.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Subscription s)voidclear()booleanhasSubscriptions()Returns true if this composite is not unsubscribed and contains subscriptions.booleanisUnsubscribed()Indicates whether thisSubscriptionis currently unsubscribed.voidremove(Subscription s)voidunsubscribe()Unsubscribe from all of the subscriptions in the list, which stops the receipt of notifications on the associatedSubscriber.private static voidunsubscribeFromAll(java.util.Collection<Subscription> subscriptions)
-
-
-
Field Detail
-
subscriptions
private java.util.List<Subscription> subscriptions
-
unsubscribed
private volatile boolean unsubscribed
-
-
Constructor Detail
-
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 Detail
-
isUnsubscribed
public boolean isUnsubscribed()
Description copied from interface:SubscriptionIndicates whether thisSubscriptionis currently unsubscribed.- Specified by:
isUnsubscribedin interfaceSubscription- Returns:
trueif thisSubscriptionis currently unsubscribed,falseotherwise
-
add
public void add(Subscription s)
Adds a newSubscriptionto thisSubscriptionListif theSubscriptionListis not yet unsubscribed. If theSubscriptionListis unsubscribed,addwill indicate this by explicitly unsubscribing the newSubscriptionas well.- Parameters:
s- theSubscriptionto 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 associatedSubscriber.- Specified by:
unsubscribein interfaceSubscription
-
unsubscribeFromAll
private static void unsubscribeFromAll(java.util.Collection<Subscription> subscriptions)
-
clear
public void clear()
-
hasSubscriptions
public boolean hasSubscriptions()
Returns true if this composite is not unsubscribed and contains subscriptions.- Returns:
trueif this composite is not unsubscribed and contains subscriptions.
-
-