// Jeremy Lipschutz // Short program showing the flexibility of using interfaces public class ListClient { public static void main(String[] args) { IntList list1 = new ArrayIntList(); processList(list1); // Just like an HDMI device we can unplug a TV cable box // and plug in a DVDPlayer! list1 = new LinkedIntList(); // this line would create an error // list1 = new IntList(); IntList list2 = new LinkedIntList(); processList(list2); } // By creating an IntList interface, we can make a method // that can take in either an ArrayIntList or LinkedIntList public static void processList(IntList list) { list.add(18); list.add(27); list.add(93); System.out.println(list); list.remove(1); System.out.println(list); } }