Class Subscriptions



  • public final class Subscriptions
    extends Object
    Helper methods and utilities for creating and working with Subscription objects
    • Method Detail

      • empty

        public static Subscription empty()
        Returns a Subscription to which unsubscribe does nothing except to change isUnsubscribed to true. It's stateful and isUnsubscribed indicates if unsubscribe is called, which is different from unsubscribed().
        
         Subscription empty = Subscriptions.empty();
         System.out.println(empty.isUnsubscribed()); // false
         empty.unsubscribe();
         System.out.println(empty.isUnsubscribed()); // true
         
        Returns:
        a Subscription to which unsubscribe does nothing except to change isUnsubscribed to true
      • unsubscribed

        @Experimental
        public static Subscription unsubscribed()
        Returns a Subscription to which unsubscribe does nothing, as it is already unsubscribed. Its isUnsubscribed always returns true, which is different from empty().
        
         Subscription unsubscribed = Subscriptions.unsubscribed();
         System.out.println(unsubscribed.isUnsubscribed()); // true
         
        Returns:
        a Subscription to which unsubscribe does nothing, as it is already unsubscribed
        Since:
        (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)