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:
 *                                                                          <p>
 *     <img src = "ArrayAndLinkedListPictures.jpg">
 *                                                                          <p>
 * This example uses a couple handy utility methods that convert between lists
 * and arrays -- <tt>asList</tt> and <tt>toArray</tt>.  These are defined in
 * the class java.util.Arrays.  Check out its javadoc <a href=
 * http://java.sun.com/javase/6/docs/api/java/util/Arrays.html> here </a>.
 * 
 */
public class ArrayListAndLinkedListExample {
    public static void main(String[] args) {

        /* Declare and initialize the ArrayList. */
        ArrayList<Integer> al =
            new ArrayList<Integer>(Arrays.asList(10,20,30,40.50));

        /* Declare and initialize the LinkedList. */
        LinkedList<Integer> ll =
            new LinkedList<Integer>(Arrays.asList(10,20,30,40.50));

        /* Show that the lists are equal as arrays. */
        System.out.println(Arrays.equals(al.toArray(), ll.toArray()));
    }
}