@Test public void addAllRace() { for (int i = 0; i < TestHelper.RACE_DEFAULT_LOOPS; i++) { final CompositeDisposable cd = new CompositeDisposable(); Runnable run = new Runnable() { @Override public void run() { cd.addAll(Disposables.empty()); } }; TestHelper.race(run, run); } }
public boolean addAll(@NonNull Disposable... ds) { ObjectHelper.requireNonNull(ds, "ds is null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(ds.length + 1); resources = set; } for (Disposable d : ds) { ObjectHelper.requireNonNull(d, "d is null"); set.add(d); } return true; } } } for (Disposable d : ds) { d.dispose(); } return false; }
CompositeDisposable implements Disposable, DisposableContainer { public boolean addAll(@NonNull Disposable... ds) { ObjectHelper.requireNonNull(ds, "ds is null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(ds.length + 1); resources = set; } for (Disposable d : ds) { ObjectHelper.requireNonNull(d, "d is null"); set.add(d); } return true; } } } for (Disposable d : ds) { d.dispose(); } return false; } }
CompositeDisposable implements Disposable, DisposableContainer { public boolean addAll(@NonNull Disposable... ds) { ObjectHelper.requireNonNull(ds, "ds is null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(ds.length + 1); resources = set; } for (Disposable d : ds) { ObjectHelper.requireNonNull(d, "d is null"); set.add(d); } return true; } } } for (Disposable d : ds) { d.dispose(); } return false; } CompositeDisposable();  CompositeDisposable(@NonNull Disposable... resources);  CompositeDisposable(@NonNull Iterable<? extends Disposable> resources); }
CompositeDisposable implements Disposable, DisposableContainer { public boolean addAll(@NonNull Disposable... ds) { ObjectHelper.requireNonNull(ds, "ds is null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(ds.length + 1); resources = set; } for (Disposable d : ds) { ObjectHelper.requireNonNull(d, "d is null"); set.add(d); } return true; } } } for (Disposable d : ds) { d.dispose(); } return false; } CompositeDisposable();  CompositeDisposable(@NonNull Disposable... resources);  CompositeDisposable(@NonNull Iterable<? extends Disposable> resources); @Override void dispose(); @Override boolean isDisposed(); @Override boolean add(@NonNull Disposable d); boolean addAll(@NonNull Disposable... ds); @Override boolean remove(@NonNull Disposable d); @Override boolean delete(@NonNull Disposable d); void clear(); int size(); }
CompositeDisposable implements Disposable, DisposableContainer { public boolean addAll(@NonNull Disposable... ds) { ObjectHelper.requireNonNull(ds, "ds is null"); if (!disposed) { synchronized (this) { if (!disposed) { OpenHashSet<Disposable> set = resources; if (set == null) { set = new OpenHashSet<Disposable>(ds.length + 1); resources = set; } for (Disposable d : ds) { ObjectHelper.requireNonNull(d, "d is null"); set.add(d); } return true; } } } for (Disposable d : ds) { d.dispose(); } return false; } CompositeDisposable();  CompositeDisposable(@NonNull Disposable... resources);  CompositeDisposable(@NonNull Iterable<? extends Disposable> resources); @Override void dispose(); @Override boolean isDisposed(); @Override boolean add(@NonNull Disposable d); boolean addAll(@NonNull Disposable... ds); @Override boolean remove(@NonNull Disposable d); @Override boolean delete(@NonNull Disposable d); void clear(); int size();  }