ListCompositeDisposable implements Disposable, DisposableContainer { @Override public boolean add(Disposable d) { ObjectHelper.requireNonNull(d, "d is null"); if (!disposed) { synchronized (this) { if (!disposed) { List<Disposable> set = resources; if (set == null) { set = new LinkedList<Disposable>(); resources = set; } set.add(d); return true; } } } d.dispose(); return false; } 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();  }
@Test public void addRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final ListCompositeDisposable cd = new ListCompositeDisposable(); Runnable run = new Runnable() { @Override public void run() { cd.add(Disposables.empty()); } }; TestHelper.race(run, run); } }