src/main/java/io/reactivex/disposables/CompositeDisposable.java
public boolean addAll(@NonNull Disposable... disposables) {
        ObjectHelper.requireNonNull(disposables, "disposables is null");
        if (!disposed) {
            synchronized (this) {
                if (!disposed) {
                    OpenHashSet<Disposable> set = resources;
                    if (set == null) {
                        set = new OpenHashSet<Disposable>(disposables.length + 1);
                        resources = set;
                    }
                    for (Disposable d : disposables) {
                        ObjectHelper.requireNonNull(d, "A Disposable in the disposables array is null");
                        set.add(d);
                    }
                    return true;
                }
            }
        }
        for (Disposable d : disposables) {
            d.dispose();
        }
        return false;
    }
public boolean addAll(@NonNull Disposable... disposables) {
        ObjectHelper.requireNonNull(disposables, "disposables is null");
        if (!disposed) {
            synchronized (this) {
                if (!disposed) {
                    OpenHashSet<Disposable> set = resources;
                    if (set == null) {
                        set = new OpenHashSet<Disposable>(disposables.length + 1);
                        resources = set;
                    }
                    for (Disposable d : disposables) {
                        ObjectHelper.requireNonNull(d, "A Disposable in the disposables array is null");
                        set.add(d);
                    }
                    return true;
                }
            }
        }
        for (Disposable d : disposables) {
            d.dispose();
        }
        return false;
    }
public boolean addAll ( @ NonNull Disposable ... disposables ) { ObjectHelper . requireNonNull ( disposables , "disposables is null" ) ; if ( ! disposed ) { synchronized ( this ) { if ( ! disposed ) { OpenHashSet < Disposable > set = resources ; if ( set == null ) { set = new OpenHashSet < Disposable > ( disposables . length + 1 ) ; resources = set ; } for ( Disposable d : disposables ) { ObjectHelper . requireNonNull ( d , "A Disposable in the disposables array is null" ) ; set . add ( d ) ; } return true ; } } } for ( Disposable d : disposables ) { d . dispose ( ) ; } return false ; }
Atomically adds the given array of Disposables to the container or
disposes them all if the container has been disposed.
@param disposables the array of Disposables
@return true if the operation was successful, false if the container has been disposed
@throws NullPointerException if {@code disposables} or any of its array items is null
Atomically adds the given array of Disposables to the container or disposes them all if the container has been disposed .