![]() |
Algorithms and Data Structures | ||||
|
Using
the generic List to process a list of integers
![]() We also need to define classes for comparing Integer objects so that we can insert into the list in order, and for testing Integer objects (for deletion). See IntComp.java to see the integer comparator, and IntPred.java to see the predicate for testing if an integer object equals a given integer value. I have used exactly the same definition of List, and have just copied it over. I should put it in a package, but that's another exercise.. Look at the code for the Test.java and compare it to the previous exercise using ToDo lists. Here's all the code |