// file: TestLinkedListInterface // author: Robert Keller // purpose: Test LinkedListInterface // description: Vector, ArrayList, and LinkedList all implement List. // One test program with a List argument is applied to each. import java.util.*; class TestListInterface { static void test(List L) { int n = 10; for( int i = 0; i < n; i++ ) { L.add(new Integer(i)); } for( int i = L.size()-1; i > 0 ; i-- ) { System.out.println(L.get(i)); } for( Iterator I = L.iterator(); I.hasNext(); ) { System.out.println(I.next()); } } public static void main(String arg[]) { Vector V = new Vector(); test(V); LinkedList L = new LinkedList(); test(L); ArrayList A = new ArrayList(); test(A); } }