@Override
    public E get(int index) {
        E elem = null;
        if (index < 0 || index > count) {
            throw new IndexOutOfBoundsException();
        }
        if (index == count) {
            elem = header.next.element;
        } else {
            Node<E> aux = null;
            if (index == count / 2) {
                aux = header.next;
                for (int i = 0; i < index; i++) {
                    aux = aux.next;
                }

            } else {
                aux = trailer.prev;
                for (int i = count; i > index; i--) {
                    aux = aux.prev;
                }
            }
            elem = aux.element;
        }
        return elem;
    }