import java.util.*;
public class HashSetIterator {
/**
* @A.J, CH 15
*/
public static void main(String[] args) {
HashSet s = new HashSet();
s.add("House");
s.add("of");
s.add("fun");
s.add("believe");
s.add("Shame");
s.add("woke");
System.out.println("The Set Contains: ");
Iterator i = s.iterator();
while (i.hasNext())
System.out.println (i.next());
System.out.println("****End of Contents***");
i.remove();
System.out.println();
System.out.println("The Set _now_ Contains: ");
Iterator z = s.iterator();
while (z.hasNext())
System.out.println (z.next());
System.out.println("****End of Contents***");
System.out.println();
System.out.println();
System.out.println("The Java Instructions have come to an END.");
}
}
/*
The Set Contains:
of
woke
House
fun
believe
Shame
****End of Contents***
The Set _now_ Contains:
of
woke
House
fun
believe
****End of Contents***
The Java Instructions have come to an END.
*/
Saturday, October 20, 2007
Iterator Example
Subscribe to:
Post Comments (Atom)
Just some daily notes ...
Things I'm into now...
Blog Archive
-
▼
2007
(29)
-
▼
October
(15)
- Deconstructing a Scheme recursive function and imp...
- Anasi Boys
- Iterator for Collection and Nested Class
- The Uninvited!
- Inheritence and PolyMorphIsm
- Iterator Example
- Java Library ArrayList
- Inserting into an array non-destructively
- Singly linked list operations...
- PascalTriangles once more!
- Sieve of Erotosthenes
- Linked List Constructor Functionality Testing
- The Linked List Maker method
- Simple Linked List operations
- Old blogs before Day 0.
-
▼
October
(15)

No comments:
Post a Comment