public Set<E> union (Set<E> other){
}
say I have a test method:
Expand|Select|Wrap|Line Numbers
- @Test
- public void testUnion() {
- ArraySet<Integer> a = new ArraySet<Integer>(10,20);
- a.add(1);
- a.add(3);
- a.add(5);
- a.add(7);
- a.add(9);
- ArraySet<Integer> b = new ArraySet<Integer>(10,20);
- b.add(2);
- b.add(4);
- b.add(6);
- b.add(8);
- b.add(10);
- Set<Integer> c = a.union(b);
- assertEquals(10,c.size());
- for (int i = 1; i<=c.size(); i++)
- assertTrue(c.contains(i));
- }