本文整理匯總了Java中java.util.concurrent.LinkedBlockingQueue.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java LinkedBlockingQueue.addAll方法的具體用法?Java LinkedBlockingQueue.addAll怎麽用?Java LinkedBlockingQueue.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.concurrent.LinkedBlockingQueue
的用法示例。
在下文中一共展示了LinkedBlockingQueue.addAll方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testAddAllSelf
import java.util.concurrent.LinkedBlockingQueue; //導入方法依賴的package包/類
/**
* addAll(this) throws IllegalArgumentException
*/
public void testAddAllSelf() {
LinkedBlockingQueue q = populatedQueue(SIZE);
try {
q.addAll(q);
shouldThrow();
} catch (IllegalArgumentException success) {}
}
示例2: testAddAll3
import java.util.concurrent.LinkedBlockingQueue; //導入方法依賴的package包/類
/**
* addAll of a collection with any null elements throws NPE after
* possibly adding some elements
*/
public void testAddAll3() {
LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE);
Integer[] ints = new Integer[SIZE];
for (int i = 0; i < SIZE - 1; ++i)
ints[i] = new Integer(i);
Collection<Integer> elements = Arrays.asList(ints);
try {
q.addAll(elements);
shouldThrow();
} catch (NullPointerException success) {}
}
示例3: testAddAll4
import java.util.concurrent.LinkedBlockingQueue; //導入方法依賴的package包/類
/**
* addAll throws IllegalStateException if not enough room
*/
public void testAddAll4() {
LinkedBlockingQueue q = new LinkedBlockingQueue(SIZE - 1);
Integer[] ints = new Integer[SIZE];
for (int i = 0; i < SIZE; ++i)
ints[i] = new Integer(i);
Collection<Integer> elements = Arrays.asList(ints);
try {
q.addAll(elements);
shouldThrow();
} catch (IllegalStateException success) {}
}