private Node getNode(int index) {
        if (index<0 || index>= size)
            throw new IndexOutOfBoundsException();

        Node current;
        if (index <= size/2) { // 正向查找
            current = head.next;
            for (int i=0; i<index; i++) // 注意这里i从0算起，所以0表示head
                current = current.next;
        } else {
            current = head.prev; // 反向查找
            for (int i=size-1; i>index; i--)
                current = current.prev;
        }
        return current;
    }