@Override
    public void removeAt(int index) {
        if(head == null){
            throw new IndexOutOfBoundsException();
        } else if(!checkIndex(index)){
            throw new IndexOutOfBoundsException();
        } else {
            Node<T> temp = head;
            for (int i = 0; i < index; i++) {
                temp = temp.right;
            }

            if (temp.left != null && temp.right != null) {  // middle
                temp.left.right = temp.right;
                temp.right.left = temp.left;
            } else if (temp.left != null && temp.right == null) {   // last
                temp.left.right = null;
            } else if (temp.left == null && temp.right != null) {   // first
                temp.right.left = null;
                head = temp.right;
            } else {
                head = null;
            }

            size--;
        }
    }