import java.util.*; public class Client { /* client(list) * list.implementor(); */ /** Returns true if value can be found in list and false otherwise. */ public static boolean search(IntList list, int value) { /* for (int i = 0; i < list.size(); i++) { if (list.get(i) == value) { return true; } } */ /* Iterator it = list.iterator(); while (it.hasNext()) { if (it.next() == value) { return true; } } */ for (int i : list) { if (i == value) { return true; } } return false; } public static void main(String[] args) { IntList arrayList = new ArrayIntList(); IntList linkedList = new LinkedIntList(); Random r = new Random(); for (int i = 0; i < 100; i++) { int rand = r.nextInt(100); arrayList.add(rand); linkedList.add(rand); } //System.out.println(arrayList.search(42)); System.out.println(search(arrayList, 42)); System.out.println(search(linkedList, 42)); } }