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

        tail = node;

        return node;
    }
@Test
    public void testEnqueue() {
        DoublyLinkedList<Integer> list = new DoublyLinkedList<Integer>();
        list.enqueue(1);
        assertFalse(list.isEmpty());
        assertEquals(1, list.size());
        assertArrayEquals(new Integer[]{1}, list.toArray());
        list.enqueue(2);
        assertFalse(list.isEmpty());
        assertEquals(2, list.size());
        assertArrayEquals(new Integer[]{2, 1}, list.toArray());
        list.enqueue(3);
        assertFalse(list.isEmpty());
        assertEquals(3, list.size());
        assertArrayEquals(new Integer[]{3, 2, 1}, list.toArray());
        assertEquals(new Integer(3), list.first());
        assertEquals(new Integer(1), list.last());
    }