import java.util.*;
public class IteratorTest {
static void fill(Collection <String> c) {
c.add("Kerkyra");
c.add("Zakynthos");
c.add("Kythira");
c.add("Santorini");
c.add("Dilos");
c.add("Samos");
c.add("Rodos");
c.add("Kastelorizo");
}
static void printAll(Collection <?> c) {
for (var i = c.iterator(); i.hasNext(); )
System.out.print(i.next() + " ");
}
public static void main(String args[]) {
var hash = new HashSet<String> ();
var list = new LinkedList<String> ();
fill(hash);
fill(list);
System.out.println("Hash contains:");
printAll(hash);
System.out.println("\nList contains:");
printAll(list);
}
}