public boolean contains(V val) {

        ListNode node = head;
        while (true) {
            if (node == null) {
                return false;
            }
            if (node.value.equals(val)) {
                return true;
            }
            node = node.next;
        }
    }