當前位置: 首頁>>代碼示例>>Java>>正文


Java DelayQueue.addAll方法代碼示例

本文整理匯總了Java中java.util.concurrent.DelayQueue.addAll方法的典型用法代碼示例。如果您正苦於以下問題:Java DelayQueue.addAll方法的具體用法?Java DelayQueue.addAll怎麽用?Java DelayQueue.addAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.util.concurrent.DelayQueue的用法示例。


在下文中一共展示了DelayQueue.addAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: realMain

import java.util.concurrent.DelayQueue; //導入方法依賴的package包/類
private static void realMain(String[] args) throws Throwable {
    Godot[] godots = new Godot[] { new Godot(), new Godot(), new Godot() };
    DelayQueue<Godot> q = new DelayQueue<>(Arrays.asList(godots));
    Iterator<Godot> it = q.iterator();
    q.clear();
    check(it.hasNext());
    equal(it.next(), godots[0]);
    it.remove();
    check(q.isEmpty());

    q.addAll(Arrays.asList(godots));
    it = q.iterator();
    check(it.hasNext());
    it.next();
    equal(it.next(), godots[1]);
    it.remove();
    equal(q.size(), 2);
    check(q.contains(godots[0]));
    check(q.contains(godots[2]));
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:21,代碼來源:Iterate.java

示例2: realMain

import java.util.concurrent.DelayQueue; //導入方法依賴的package包/類
private static void realMain(String[] args) throws Throwable {
    Godot[] godots = new Godot[] { new Godot(), new Godot(), new Godot() };
    DelayQueue<Godot> q = new DelayQueue<Godot>(Arrays.asList(godots));
    Iterator<Godot> it = q.iterator();
    q.clear();
    check(it.hasNext());
    equal(it.next(), godots[0]);
    it.remove();
    check(q.isEmpty());

    q.addAll(Arrays.asList(godots));
    it = q.iterator();
    check(it.hasNext());
    it.next();
    equal(it.next(), godots[1]);
    it.remove();
    equal(q.size(), 2);
    check(q.contains(godots[0]));
    check(q.contains(godots[2]));
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:21,代碼來源:Iterate.java

示例3: testAddAllSelf

import java.util.concurrent.DelayQueue; //導入方法依賴的package包/類
/**
 * addAll(this) throws IllegalArgumentException
 */
public void testAddAllSelf() {
    DelayQueue q = populatedQueue(SIZE);
    try {
        q.addAll(q);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:11,代碼來源:DelayQueueTest.java

示例4: testAddAll3

import java.util.concurrent.DelayQueue; //導入方法依賴的package包/類
/**
 * addAll of a collection with any null elements throws NPE after
 * possibly adding some elements
 */
public void testAddAll3() {
    DelayQueue q = new DelayQueue();
    PDelay[] a = new PDelay[SIZE];
    for (int i = 0; i < SIZE - 1; ++i)
        a[i] = new PDelay(i);
    try {
        q.addAll(Arrays.asList(a));
        shouldThrow();
    } catch (NullPointerException success) {}
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:15,代碼來源:DelayQueueTest.java

示例5: testAddAllSelf

import java.util.concurrent.DelayQueue; //導入方法依賴的package包/類
/**
 * addAll(this) throws IAE
 */
public void testAddAllSelf() {
    DelayQueue q = populatedQueue(SIZE);
    try {
        q.addAll(q);
        shouldThrow();
    } catch (IllegalArgumentException success) {}
}
 
開發者ID:campolake,項目名稱:openjdk9,代碼行數:11,代碼來源:DelayQueueTest.java


注:本文中的java.util.concurrent.DelayQueue.addAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。