Code example for LinkedHashSet

Methods: contains, remove, size

0
	 * @tests java.util.LinkedHashSet#remove(java.lang.Object) 
	 */ 
	public void test_removeLjava_lang_Object() { 
		// Test for method boolean 
		// java.util.LinkedHashSet.remove(java.lang.Object) 
		int size = hs.size();
		hs.remove(new Integer(98));
		assertTrue("Failed to remove element", !hs.contains(new Integer(98)));
		assertTrue("Failed to decrement set size", hs.size() == size - 1);
 
		LinkedHashSet s = new LinkedHashSet();
		s.add(null);
		assertTrue("Cannot handle null", s.remove(null));
	} 
 
	/** 
	 * @tests java.util.LinkedHashSet#size() 
	 */ 
	public void test_size() { 
		// Test for method int java.util.LinkedHashSet.size() 
		assertTrue("Returned incorrect size", hs.size() == (objArray.length + 1));