class DoublyLinkedList implements Iterable<T> {

    public ListNode2<T> add(T value)
    {
        ListNode2<T> node = new ListNode2<T>(value);
        if (size++ == 0)
        {
            tail = node;
        }
        else
        {
            node.prev = head;
            head.next = node;
        }

        head = node;

        return node;
    }

}