Java Code Examples for java.util.concurrent.DelayQueue#addAll()
The following examples show how to use
java.util.concurrent.DelayQueue#addAll() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Iterate.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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])); }
Example 2
Source File: DelayQueueTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * addAll(this) throws IAE */ public void testAddAllSelf() { DelayQueue q = populatedQueue(SIZE); try { q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} }
Example 3
Source File: DelayQueueTest.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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) {} }
Example 4
Source File: DelayQueueTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * addAll(this) throws IAE */ public void testAddAllSelf() { DelayQueue q = populatedQueue(SIZE); try { q.addAll(q); shouldThrow(); } catch (IllegalArgumentException success) {} }
Example 5
Source File: DelayQueueTest.java From j2objc with Apache License 2.0 | 5 votes |
/** * 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) {} }