@Test public void testCancel() { SetDynamicCompositeCancellable c = new SetDynamicCompositeCancellable(); Cancellable cancellable = mock(Cancellable.class); c.add(cancellable); c.cancel(); verify(cancellable).cancel(); c.remove(cancellable); }
@Override public void cancel() { if (cancelledUpdater.compareAndSet(this, 0, 1)) { cancelAll(); } }
SetDynamicCompositeCancellable implements DynamicCompositeCancellable { @Override public void cancel() { if (cancelledUpdater.compareAndSet(this, 0, 1)) { cancelAll(); } } }
SetDynamicCompositeCancellable implements DynamicCompositeCancellable { @Override public void cancel() { if (cancelledUpdater.compareAndSet(this, 0, 1)) { cancelAll(); } } SetDynamicCompositeCancellable();   SetDynamicCompositeCancellable(int initialSize); }
SetDynamicCompositeCancellable implements DynamicCompositeCancellable { @Override public void cancel() { if (cancelledUpdater.compareAndSet(this, 0, 1)) { cancelAll(); } } SetDynamicCompositeCancellable();   SetDynamicCompositeCancellable(int initialSize); @Override void cancel(); @Override boolean add(Cancellable toAdd); @Override boolean remove(Cancellable toRemove); @Override boolean isCancelled(); }
SetDynamicCompositeCancellable implements DynamicCompositeCancellable { @Override public void cancel() { if (cancelledUpdater.compareAndSet(this, 0, 1)) { cancelAll(); } } SetDynamicCompositeCancellable();   SetDynamicCompositeCancellable(int initialSize); @Override void cancel(); @Override boolean add(Cancellable toAdd); @Override boolean remove(Cancellable toRemove); @Override boolean isCancelled();  }