Same as {@link Collection#addAll(Collection)} but in case of RandomAccess iterates over indices
968757
public static <T> void addAll(Collection<? super T> collection, Collection<? extends T> toAdd)
    {
        if (collection == null || toAdd == null)
        {
            return;
        }
        if (toAdd instanceof RandomAccess)
        {
            List<? extends T> randomAccess = (List<? extends T>) toAdd;
            for (int i = 0, size = randomAccess.size(); i < size; i++)
            {
                T element = randomAccess.get(i);
                collection.add(element);
            }
        }
        else
        {
            collection.addAll(toAdd);
        }
    }
1075471
public void addAll(Collection<? extends M> collection) {
        if (collection != null) {
            items.addAll(collection);
            applyFilter();
        }
    }
840084
public static <T> Collection<T> addAllNotNull(Collection<T> to, Collection<? extends T> what) {
        Collection<T> data = safeCollection(to);
        if (!isEmpty(what)) {
            for (T t : what) {
                if (t != null) {
                    data.add(t);
                }
            }
        }
        return data;
    }
623803
public void add(int num, int[] indices) {
        for (int i = 0; i < indices.length; ++i)
            indices[i] += num;
    }
262946
@ReplacedBy("com.google.common.collect.Iterators#addAll()")
    public static <T, C extends Collection<T>> C addAll (C col, Iterator<? extends T> iter)
    {
        while (iter.hasNext()) {
            col.add(iter.next());
        }
        return col;
    }
614628
public static <T> List<T> distinct(final Collection<? extends T> c, final int fromIndex, final int toIndex) {
        checkFromToIndex(fromIndex, toIndex, size(c));

        if (N.isNullOrEmpty(c) && fromIndex == 0 && toIndex == 0) {
            return new ArrayList<>();
        }

        final List<T> result = new ArrayList<>();
        final Set<Object> set = new HashSet<>();
        T e = null;

        if (c instanceof List && c instanceof RandomAccess) {
            final List<T> list = (List<T>) c;

            for (int i = fromIndex; i < toIndex; i++) {
                e = list.get(i);

                if (set.add(hashKey(e))) {
                    result.add(e);
                }
            }
        } else {
            final Iterator<? extends T> it = c.iterator();

            for (int i = 0; i < toIndex && it.hasNext(); i++) {
                e = it.next();

                if (i < fromIndex) {
                    continue;
                }

                if (set.add(hashKey(e))) {
                    result.add(e);
                }
            }
        }

        return result;
    }
1220206
public static <E, T extends E> void add(List<E> list, int index, T item){
        if(index<list.size())
            list.add(index, item);
        else
            list.add(item);
    }
401539
public boolean addAll(int[] items) {
    ensureCapacity(size + items.length);
    for (int i = 0; i < items.length; i++) {
      elements[size++] = items[i];
    }
    return items.length > 0;
  }
280357
public static <T> boolean addAllIterable(Iterable<? extends T> iterable, Collection<T> targetCollection)
    {
        if (iterable == null)
        {
            throw new NullPointerException();
        }
        if (iterable instanceof Collection<?>)
        {
            return targetCollection.addAll((Collection<T>) iterable);
        }
        int oldSize = targetCollection.size();
        Iterate.forEachWith(iterable, Procedures2.<T>addToCollection(), targetCollection);
        return targetCollection.size() != oldSize;
    }
401092
@Override
    public boolean addAll(Collection<? extends RedisClusterNode> c) {

        LettuceAssert.noNullElements(c, "Partitions must not contain null elements");

        synchronized (partitions) {
            boolean b = partitions.addAll(c);
            updateCache();
            return b;
        }
    }
947513
public static <T> boolean addAll(Collection<T> target, Iterable<? extends T> iterable) {
        if (iterable instanceof Collection) {
            return target.addAll((Collection<? extends T>) iterable);
        }
        return Iterators.addAll(target, iterable.iterator());
    }
169478
public void addAll(Iterable<? extends DOCUMENT> documents) {
      if (documents != null) {
         for (DOCUMENT doc : documents) {
            add(doc);
         }
      }
   }
684264
public static <K, V> Collection<K> addAllKeysTo(Map<K, V> map, Collection<K> targetCollection)
    {
        MapIterate.forEachKey(map, CollectionAddProcedure.on(targetCollection));
        return targetCollection;
    }
950968
public void addAll(Collection<? extends E> c) {
        for (E element : c)
            add(element);
    }

    /**
     * Returns true if the element could have been inserted into the Bloom filter.
     * Use getFalsePositiveProbability() to calculate the probability of this
     * being correct.
     *
     * @param element element to check.
     * @return true if the element could have been inserted into the Bloom filter.
     */
    public boolean contains(E element) {
       long hash;
       String valString = element.toString();
       for (int x = 0; x < k; x++) {
           hash = createHash(valString + Integer.toString(x));
           hash = hash % (long)bitSetSize;
           if (!bitset.get(Math.abs((int)hash)))
               return false;
       }
       return true;
    }

    /**
     * Returns true if all the elements of a Collection could have been inserted
     * into the Bloom filter. Use getFalsePositiveProbability() to calculate the
     * probability of this being correct.
     * @param c elements to check.
     * @return true if all the elements in c could have been inserted into the Bloom filter.
     */
    public boolean containsAll(Collection<? extends E> c) {
        for (E element : c)
            if (!contains(element))
                return false;
        return true;
    }

    /**
     * Read a single bit from the Bloom filter.
     * @param bit the bit to read.
     * @return true if the bit is set, false if it is not.
     */
    public boolean getBit(int bit) {
        return bitset.get(bit);
    }

    /**
     * Set a single bit in the Bloom filter.
     * @param bit is the bit to set.
     * @param value If true, the bit is set. If false, the bit is cleared.
     */
    public void setBit(int bit, boolean value) {
        bitset.set(bit, value);
    }

    /**
     * Return the bit set used to store the Bloom filter.
     * @return bit set representing the Bloom filter.
     */
    public BitSet getBitSet() {
        return bitset;
    }

    /**
     * Returns the number of bits in the Bloom filter. Use count() to retrieve
     * the number of inserted elements.
     *
     * @return the size of the bitset used by the Bloom filter.
     */
    public int size() {
        return this.bitSetSize;
    }

    /**
     * Returns the number of elements added to the Bloom filter after it
     * was constructed or after clear() was called.
     *
     * @return number of elements added to the Bloom filter.
     */
    public int count() {
        return this.numberOfAddedElements;
    }

    /**
     * Returns the expected number of elements to be inserted into the filter.
     * This value is the same value as the one passed to the constructor.
     *
     * @return expected number of elements.
     */
    public int getExpectedNumberOfElements() {
        return expectedNumberOfFilterElements;
    }

    /**
     * Get expected number of bits per element when the Bloom filter is full. This value is set by the constructor
     * when the Bloom filter is created. See also getBitsPerElement().
     *
     * @return expected number of bits per element.
     */
    public double getExpectedBitsPerElement() {
        return this.bitsPerElement;
    }

    /**
     * Get actual number of bits per element based on the number of elements that have currently been inserted and the length
     * of the Bloom filter. See also getExpectedBitsPerElement().
     *
     * @return number of bits per element.
     */
    public double getBitsPerElement() {
        return this.bitSetSize / (double)numberOfAddedElements;
    }
}
985739
@Override
  public void addAll(Map<K, V> m) {
    for (Map.Entry<K, V> e : m.entrySet()) {
      add(e.getKey(), e.getValue());
    }
  }
169311
public static <T> Collection<T> eachWithIndex(Collection<T> self, @ClosureParams(value=FromString.class, options="T,Integer") Closure closure) {
        return (Collection<T>) eachWithIndex((Iterable<T>) self, closure);
    }
659521
public static <T> Collection<T> addAll(Collection<T> to, Collection<? extends T> what) {
        Collection<T> data = safeCollection(to);
        if (!isEmpty(what)) {
            data.addAll(what);
        }
        return data;
    }