@Test public void testUnsubscribeOnlyOnce() { Runnable dispose = mock(Runnable.class); Disposable subscription = Disposables.fromRunnable(dispose); subscription.dispose(); subscription.dispose(); verify(dispose, times(1)).run(); }
@NonNull public static Disposable fromRunnable(@NonNull Runnable run) { ObjectHelper.requireNonNull(run, "run is null"); return new RunnableDisposable(run); }
Disposables { @NonNull public static Disposable fromRunnable(@NonNull Runnable run) { ObjectHelper.requireNonNull(run, "run is null"); return new RunnableDisposable(run); } }
Disposables { @NonNull public static Disposable fromRunnable(@NonNull Runnable run) { ObjectHelper.requireNonNull(run, "run is null"); return new RunnableDisposable(run); } private  Disposables(); }
Disposables { @NonNull public static Disposable fromRunnable(@NonNull Runnable run) { ObjectHelper.requireNonNull(run, "run is null"); return new RunnableDisposable(run); } private  Disposables(); @NonNull static Disposable fromRunnable(@NonNull Runnable run); @NonNull static Disposable fromAction(@NonNull Action run); @NonNull static Disposable fromFuture(@NonNull Future<?> future); @NonNull static Disposable fromFuture(@NonNull Future<?> future, boolean allowInterrupt); @NonNull static Disposable fromSubscription(@NonNull Subscription subscription); @NonNull static Disposable empty(); @NonNull static Disposable disposed(); }
Disposables { @NonNull public static Disposable fromRunnable(@NonNull Runnable run) { ObjectHelper.requireNonNull(run, "run is null"); return new RunnableDisposable(run); } private  Disposables(); @NonNull static Disposable fromRunnable(@NonNull Runnable run); @NonNull static Disposable fromAction(@NonNull Action run); @NonNull static Disposable fromFuture(@NonNull Future<?> future); @NonNull static Disposable fromFuture(@NonNull Future<?> future, boolean allowInterrupt); @NonNull static Disposable fromSubscription(@NonNull Subscription subscription); @NonNull static Disposable empty(); @NonNull static Disposable disposed();  }