Importance of Collection Classes cont’d
In this article it is going to be with the help of SubList, and with the help of ListIterator we can limit or set the boundary condition for number of Object’s references to be taken from the Vector which is filtered into another sub list.import java.util.ListIterator;
import java.util.Vector;
public class TrySimpleVectorWithListItratrsubList {
public static void main(String[] args) {
String[] cardGames = { “Hearts”, “Poker”, “Trump”, “Blind”, “Bluff” };
Vector cardGamesVect = new Vector();
for (int i = 0; i < cardGames.length; i++) {
System.out.println(“A Normal Array : ” + cardGames[i]);
cardGamesVect.add(cardGames[i]);
}
ListIterator cardGameList = cardGamesVect.subList(2, 4).listIterator(0);
while (cardGameList.hasNext()) {
System.out.println(“From Vector Using sub List : “
+ cardGameList.next());
}
}
}





























