public Object remove(int p) {
        Object t = null;
        if (p < 0 || p >= _size) {
            return t;
        }
        if (p == 0) {
            int tmp = array[head].getNext();
            array[head].setPrev(-1);
            array[head].setNext(-1);
            t = array[head].getData();
            array[head].setData(null);
            if (tmp != -1) {
                array[tmp].setPrev(-1);
                head = tmp;
            } else {
                head = 0;
            }
        } else if (p == _size - 1) {
            int temp = head;
            for (int i = 0; i < p; ++i) {
                temp = array[temp].getNext();
            }
            array[temp].setNext(-1);
            array[array[temp].getPrev()].setNext(-1);
            tail = array[temp].getPrev();
            array[temp].setPrev(-1);
            t = array[temp].getData();
            array[temp].setData(null);
        } else {
            int temp = head;
            for (int i = 0; i < p; ++i) {
                temp = array[temp].getNext();
            }
            array[array[temp].getPrev()].setNext(array[temp].getNext());
            array[array[temp].getNext()].setPrev(array[temp].getPrev());
            array[temp].setPrev(-1);
            array[temp].setNext(-1);
            t = array[temp].getData();
            array[temp].setData(null);
            
        }
        _size--;
        return t;
    }