// AddDouble.java class DoubleList { // a Node of the list private class Node { public Type data; public Node next; public Node prev; } // we store the head and tail private Node head; private Node tail; // the list starts empty public DoubleList() { head = null; tail = null; } // add a new value to the end public void append(Type value) { Node newNode = new Node(); newNode.data = value; newNode.prev = tail; newNode.next = null; // set node before to point to new node, or head if (tail != null) { tail.next = newNode; } else { head = newNode; } tail = newNode; } } public class AddDouble { public static void main(String args[]) { // make the list DoubleList list = new DoubleList(); // add some nodes at the end for (int i = 1; i <= Integer.parseInt(args[0]); i++) { list.append(i * 10); } } }