import java.util.*; /**** * * This is a very simple example of a 5-element list of integers, declared as * both an ArrayList and a LinkedList. The interesting thing is the picture of * how memory looks inside the data abstractions: *
*
*
* This example uses a couple handy utility methods that convert between lists
* and arrays -- asList and toArray. These are defined in
* the class java.util.Arrays. Check out its javadoc here .
*
*/
public class ArrayListAndLinkedListExample {
public static void main(String[] args) {
/* Declare and initialize the ArrayList. */
ArrayList