Unformatted text preview: 2 Constrained ArrayLists a1 Integer a4 Integer 7 a2 Integer5 a0 ArrayList a1 1 a4 2 a2 Integer Integer Integer b= new ArrayList<Integer>(); b a0 A call b.add(x) in which x is not of class Integer (or one of its subclasses) is illegal) Using a constrained ArrayList reduces the chance of making an error by adding something to a list that does not belong there....
View
Full
Document
This note was uploaded on 07/07/2008 for the course CS 101 taught by Professor Gries during the Spring '08 term at Cornell.
 Spring '08
 GRIES

Click to edit the document details