I am writing a method with header like this:
public Set<E> union (Set<E> other){
}
say I have a test method:
how can I say the representation of a in the method body?? I know b can be represented as other in the union method head because the union method takes other as it's argument and that argument is b in this case. but what is a??
public Set<E> union (Set<E> other){
}
say I have a test method:
Code:
@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));
}
Comment