@Test
	public void testIterate() {
		Bag<Integer> myList = new Bag<Integer>();		
		Set<Integer> mySet = new HashSet<Integer>();
		
		for (int i = 0; i < 5; ++i) {
			myList.add(i);
			mySet.add(i);
		}

		myList.reset();
		for (int i = 0; i < 5; ++i) {
			assertTrue(myList.hasNext());
			Integer x = myList.next();
			assertTrue(mySet.contains(x));
			mySet.remove(x);
		}
		assertTrue(mySet.isEmpty());
		
		for (int i = 0; i < 100; ++i) {
			assertFalse(myList.hasNext());			
		}
		
		for (int i = 0; i < 5; ++i) {
			mySet.add(i);
		}
		
		myList.reset();
		for (int i = 0; i < 5; ++i) {
			assertTrue(myList.hasNext());
			Integer x = myList.next();
			assertTrue(mySet.contains(x));
			mySet.remove(x);
		}
		assertTrue(mySet.isEmpty());
		
		for (int i = 0; i < 100; ++i) {
			assertFalse(myList.hasNext());			
		}		
	}