Wrapper classes

       Double x = 1.0; // boxes 1.0 into a Double object
       double y = x + 22;   // here the value of x is automatically unboxed to be used in the expression


ArrayList

       ArrayList myList = new ArrayList(100); // creates a new ArrayList with an initial capacity of 100

       myList.add("Fred Flintstone"); // add Fred to the end of the list

       myList.add(2, "Barney Rubble"); // inserts Barney rubble into position 2 (counting from 0) in the list, moves existing items.

      myList.set(2,"Roger Ramjet");   // replaces the item at position 2 with "Roger Ramjet"

myList.remove(4); // removes item in position 4 (5th item counting from 0)

myList.remove("Barney Rubble");  // removes item Barney Rubble from the list

myList.clear(); // removes all the items
int count = myList.size(); // count now holds the number of items added to the ArrayList
String str = (String)myList.get(3);  // get the item at position 3 (fourth item counting from 0)
String first = (String)myList.get(0); // get the first item, ie item at position 0.
for(int i = 0; i < myList.size(); i++)
 {
    String str = (String)myList.get(i);
    System.out.println(str);
}

Using generics with ArrayLists

ArrayList<String> myList = new ArrayList<String>(100);  // create a ArrayList that will hold strings, initially size it to 100
       myList.add("Fred Flintstone);
    String name = myList.get(0);   //   get the first item

   myList.remove(0); // remove the first item
   myList.clear();  // clean out the list