
1 52
Chapter 9: Collections II
The subList(startposition, endposition) method is used to create a sublist from the
current list starting at startposition inclusive to endposition exclusive. For example, the
statement
List cl = c. subList(2, 4) ;
creates a sublist cl with contents "Smith", "Brown".
The List interface also provides its own iterator, ListIterator, in addition to the
Collection interface iterator. ListIterator inherits all the methods of Iterator but in ad-
dition provides methods such as previous and hasPrevious for iterating through a list in the
reverse direction, previous returns the previous element in ...