/** containsAll(c) is true when c contains a subset of elements */ public void testContainsAll() { DelayQueue q = populatedQueue(SIZE); DelayQueue p = new DelayQueue(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new PDelay(i)); } assertTrue(p.containsAll(q)); }
/** retainAll(c) retains only those elements of c and reports true if changed */ public void testRetainAll() { DelayQueue q = populatedQueue(SIZE); DelayQueue p = populatedQueue(SIZE); for (int i = 0; i < SIZE; ++i) { boolean changed = q.retainAll(p); if (i == 0) assertFalse(changed); else assertTrue(changed); assertTrue(q.containsAll(p)); assertEquals(SIZE - i, q.size()); p.remove(); } }