public void testSet(Set<Object> set) {
		// first test add and contains
		set.clear();
		assertTrue("Clear should make it empty", set.isEmpty());
		Object[] items=new Object[itemCount];
		for (int i =0; i < itemCount; i++) {
			Integer o =Integer.valueOf(i);
			items[i]=o;
			set.add(o);
			assertTrue("add/contains", set.contains(o));
			assertEquals("Size check", i + 1, set.size());
		}

		for (int i =0; i < itemCount; i++) {
			Object o =items[i];
			boolean mod =set.remove(o);
			assertTrue("remove returns true", mod);
			assertFalse("remove/contains", set.contains(o));
			assertEquals("Size check", itemCount - i - 1, set.size());
		}

		set.clear();
		assertTrue("Clear should make it empty", set.isEmpty());

		for (int i =0; i < itemCount; i++) {
			Integer o =Integer.valueOf(random.nextInt());
			items[i]=o;
			set.add(o);
			assertTrue("add/contains Random:" + set.size() + "\t" + o, set.contains(o));
		}

		set.clear();
		assertTrue("Clear should make it empty", set.isEmpty());

		// now for the iterators part...
		int count =0;
		for (Object o : set) {
			assertTrue("iterator contains", set.contains(o));
			count++;
		}
		assertEquals("iterator size check", count, set.size());

		Iterator<Object> iterator =set.iterator();
		while (iterator.hasNext()) {
			Object o =iterator.next();
			assertTrue("iterator contains", set.contains(o));
			iterator.remove();
			assertFalse("iterator removed", set.contains(o));
		}
		assertTrue("everything removed with an iterator", set.isEmpty());

		// now for collections of add and remove...
		HashSet<Object> hashSet =new HashSet<Object>();
		for (int i =0; i < itemCount; i++) {
			hashSet.add(random.nextDouble());
		}

		set.clear();
		assertTrue("Clear should make it empty", set.isEmpty());
		set.addAll(hashSet);
		assertTrue("contains All", set.containsAll(hashSet));
		set.remove(set.iterator().next());
		assertFalse("!contains All", set.containsAll(hashSet));

		HashSet<Object> hashSet2 =new HashSet<Object>();
		count =0;
		for (Object o : hashSet) {
			hashSet2.add(o);
			count++;
			if (count >= set.size() / 2)
				break;
		}

		set.addAll(hashSet);
		set.removeAll(hashSet2);
		assertEquals("remove all", hashSet.size() - hashSet2.size(), set.size());
		set.addAll(hashSet);
		set.retainAll(hashSet2);
		assertEquals("retain all", hashSet2.size(), set.size());
		assertTrue("retain all", set.containsAll(hashSet2));
		assertFalse("retain all", set.containsAll(hashSet));

		Object hash1=new Object(){
			@Override
			public int hashCode() {
			
				return 1;
			}
		};
		Object one=1;
		set.clear();
		set.add(hash1);
		set.add(one);
		assertEquals(2, set.size());
		set.remove(hash1);
		set.add(one);
		assertEquals(1, set.size());
		
	}