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;
    }
@Test
    public void testAdd() {
        DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();
        list.add(1);
        assertFalse(list.isEmpty());
        assertEquals(1, list.size());
        assertArrayEquals(new Integer[]{1}, list.toArray());
        list.add(2);
        assertFalse(list.isEmpty());
        assertEquals(2, list.size());
        assertArrayEquals(new Integer[]{1, 2}, list.toArray());
        list.add(3);
        assertFalse(list.isEmpty());
        assertEquals(3, list.size());
        assertArrayEquals(new Integer[]{1, 2, 3}, list.toArray());
        assertEquals(new Integer(1), list.first());
    }