This preview shows page 1. Sign up to view the full content.
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
 Spring '08
 GRIES

Click to edit the document details