List filter in Java8 using isPresent method
You should use noneMatch()
if (mylist.stream().noneMatch(str -> str.equalsIgnoreCase(testString))) {
System.out.println("Value is not Present");
}
You should be using Stream#noneMatch
for this. It will make your code more readable and more concise. Also, try to avoid putting to much logic inside of your if statement, extract a max in readable variables
List<String> mylist = new ArrayList<>();
mylist.add("test");
mylist.add("test1");
Predicate<String> equalsIgnoreCasePredicate = str -> str.equalsIgnoreCase("test");
boolean noneMatchString = mylist.stream().noneMatch(equalsIgnoreCasePredicate);
if (noneMatchString) {
System.out.println("Value is not Present");
}