Name of Program: ArrayList with Iterators
Date Started : March 2,2009
Date Ended: March 2,2009
Purpose: To try implementations that deals with ArrayList and Iterators.***/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.ListIterator;
public class iterators {
public static void main(String args[]) {
ArrayList<
wen.add("Jessel Ann Abellana");
wen.add("Nerissa Agapay");
wen.add("Mixie Tulid");
wen.add("Rosedil Mobreros");
wen.add("Ana Mae Respecia");
wen.add("Wendel Bocong");
System.out.print("Original contents of wen: ");
Iterator<
while (boc.hasNext())
{
String element = boc.next();
System.out.print(element + " ");
}
System.out.println();
ListIterator<
while (del.hasNext())
{
String element = del.next();
del.set(element + "+");
}
System.out.println("Size of wen after additions: " + wen.size());
wen.remove(1);
{
System.out.println("Size of wen after deletions: " + wen.size());
System.out.println("Contents of wen: " + wen );
}
}
}
Things I learned in this exercise:
- the implementation of array list is more comprehensive compared to array.
No comments:
Post a Comment