Example usage for java.util.concurrent ArrayBlockingQueue addAll

List of usage examples for java.util.concurrent ArrayBlockingQueue addAll

Introduction

In this page you can find the example usage for java.util.concurrent ArrayBlockingQueue addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:de.vandermeer.skb.interfaces.strategies.collections.queue.ArrayBlockingQueueStrategy.java

/**
 * Returns a new collection for the given collection.
 * @param capacity the queue's capacity/*from  w  w w  .j  av  a 2s .co m*/
 * @param collection input collection
 * @return new collection
 */
default ArrayBlockingQueue<T> get(int capacity, Collection<T> collection) {
    ArrayBlockingQueue<T> ret = new ArrayBlockingQueue<T>(capacity);
    if (collection != null) {
        ret.addAll(collection);
    }
    return ret;
}