public void deleteElement(String value) {
        ListElement index = head;
        if (index.value.equals(value)) {
            deleteFromBegin();
        } else {
            while (index.next != null) {
                if (index.next.value.equals(value)) {
                    index.next = index.next.next;
                } else {
                    index = index.next;
                }
            }
            if ((index.next == null) && (index.value.equals(value))) {
                deleteFromEnd();
            }
        }
    }