//: c11:SimpleCollection.java // A simple example using Java 2 Collections. // From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 // www.BruceEckel.com. See copyright notice in CopyRight.txt. import com.bruceeckel.simpletest.*; import java.util.*; public class SimpleCollection { private static Test monitor = new Test(); public static void main(String[] args) { // Upcast because we just want to // work with Collection features Collection c = new ArrayList(); for(int i = 0; i < 10; i++) c.add(Integer.toString(i)); Iterator it = c.iterator(); while(it.hasNext()) System.out.println(it.next()); monitor.expect(new String[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9" }); } } ///:~