Exemplo n.º 1
0
 /** containsAll(c) is true when c contains a subset of elements */
 public void testDescendingContainsAll() {
   NavigableSet q = populatedSet(SIZE);
   NavigableSet p = dset0();
   for (int i = 0; i < SIZE; ++i) {
     assertTrue(q.containsAll(p));
     assertFalse(p.containsAll(q));
     p.add(new Integer(i));
   }
   assertTrue(p.containsAll(q));
 }
Exemplo n.º 2
0
  /** retainAll(c) retains only those elements of c and reports true if changed */
  public void testDescendingRetainAll() {
    NavigableSet q = populatedSet(SIZE);
    NavigableSet p = populatedSet(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.pollFirst();
    }
  }