@Test public void disposeThrows() { Disposable d = new Disposable() { @Override public void dispose() { throw new TestException(); } @Override public boolean isDisposed() { return false; } }; ListCompositeDisposable lcd = new ListCompositeDisposable(d, d); try { lcd.dispose(); fail("Should have thrown!"); } catch (CompositeException ex) { List<Throwable> list = ex.getExceptions(); TestHelper.assertError(list, 0, TestException.class); TestHelper.assertError(list, 1, TestException.class); } lcd = new ListCompositeDisposable(d); try { lcd.dispose(); fail("Should have thrown!"); } catch (TestException ex) { } }
@Override public void dispose() { if (disposed) { return; } List<Disposable> set; synchronized (this) { if (disposed) { return; } disposed = true; set = resources; resources = null; } dispose(set); }
ListCompositeDisposable implements Disposable, DisposableContainer { @Override public void dispose() { if (disposed) { return; } List<Disposable> set; synchronized (this) { if (disposed) { return; } disposed = true; set = resources; resources = null; } dispose(set); } }
ListCompositeDisposable implements Disposable, DisposableContainer { @Override public void dispose() { if (disposed) { return; } List<Disposable> set; synchronized (this) { if (disposed) { return; } disposed = true; set = resources; resources = null; } dispose(set); } ListCompositeDisposable();  ListCompositeDisposable(Disposable... resources);  ListCompositeDisposable(Iterable<? extends Disposable> resources); }
ListCompositeDisposable implements Disposable, DisposableContainer { @Override public void dispose() { if (disposed) { return; } List<Disposable> set; synchronized (this) { if (disposed) { return; } disposed = true; set = resources; resources = null; } dispose(set); } ListCompositeDisposable();  ListCompositeDisposable(Disposable... resources);  ListCompositeDisposable(Iterable<? extends Disposable> resources); @Override void dispose(); @Override boolean isDisposed(); @Override boolean add(Disposable d); boolean addAll(Disposable... ds); @Override boolean remove(Disposable d); @Override boolean delete(Disposable d); void clear(); }
ListCompositeDisposable implements Disposable, DisposableContainer { @Override public void dispose() { if (disposed) { return; } List<Disposable> set; synchronized (this) { if (disposed) { return; } disposed = true; set = resources; resources = null; } dispose(set); } ListCompositeDisposable();  ListCompositeDisposable(Disposable... resources);  ListCompositeDisposable(Iterable<? extends Disposable> resources); @Override void dispose(); @Override boolean isDisposed(); @Override boolean add(Disposable d); boolean addAll(Disposable... ds); @Override boolean remove(Disposable d); @Override boolean delete(Disposable d); void clear();  }