本文整理匯總了Java中java.util.concurrent.ConcurrentLinkedDeque.toArray方法的典型用法代碼示例。如果您正苦於以下問題:Java ConcurrentLinkedDeque.toArray方法的具體用法?Java ConcurrentLinkedDeque.toArray怎麽用?Java ConcurrentLinkedDeque.toArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.util.concurrent.ConcurrentLinkedDeque
的用法示例。
在下文中一共展示了ConcurrentLinkedDeque.toArray方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testToArray
import java.util.concurrent.ConcurrentLinkedDeque; //導入方法依賴的package包/類
/**
* toArray() contains all elements in FIFO order
*/
public void testToArray() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
Object[] o = q.toArray();
for (int i = 0; i < o.length; i++)
assertSame(o[i], q.poll());
}
示例2: testToArray2
import java.util.concurrent.ConcurrentLinkedDeque; //導入方法依賴的package包/類
/**
* toArray(a) contains all elements in FIFO order
*/
public void testToArray2() {
ConcurrentLinkedDeque<Integer> q = populatedDeque(SIZE);
Integer[] ints = new Integer[SIZE];
Integer[] array = q.toArray(ints);
assertSame(ints, array);
for (int i = 0; i < ints.length; i++)
assertSame(ints[i], q.poll());
}
示例3: testToArray_NullArg
import java.util.concurrent.ConcurrentLinkedDeque; //導入方法依賴的package包/類
/**
* toArray(null) throws NullPointerException
*/
public void testToArray_NullArg() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
try {
q.toArray(null);
shouldThrow();
} catch (NullPointerException success) {}
}
示例4: testToArray1_BadArg
import java.util.concurrent.ConcurrentLinkedDeque; //導入方法依賴的package包/類
/**
* toArray(incompatible array type) throws ArrayStoreException
*/
public void testToArray1_BadArg() {
ConcurrentLinkedDeque q = populatedDeque(SIZE);
try {
q.toArray(new String[10]);
shouldThrow();
} catch (ArrayStoreException success) {}
}