Error
The method noneMatch(Predicate<? super String>) in the type Stream<String> is not applicable for the arguments (String)
Error Type
Compile Time ( Java 8 )
Sample Code
Set<String> strSet = new HashSet<String>();
strSet.add("Value");
strSet.add("value");
strSet.add("ValuE");
strSet.add("valuE");
System.out.println(strSet.stream().noneMatch("Value"));
Cause
The method anyMatch expects the argument as the Predicate and not the String.
Resolution
Specify the Predicate as the filter function argument.
Set<String> strSet = new HashSet<String>();
strSet.add("Value");
strSet.add("value");
strSet.add("ValuE");
strSet.add("valuE");
Predicate<String> capStartFilter = (p) -> (p.charAt(0) < 90);
strSet.stream().filter(capStartFilter).noneMatch(capStartFilter);
The method noneMatch(Predicate<? super String>) in the type Stream<String> is not applicable for the arguments (String)
Error Type
Compile Time ( Java 8 )
Sample Code
Set<String> strSet = new HashSet<String>();
strSet.add("Value");
strSet.add("value");
strSet.add("ValuE");
strSet.add("valuE");
System.out.println(strSet.stream().noneMatch("Value"));
Cause
The method anyMatch expects the argument as the Predicate and not the String.
Resolution
Specify the Predicate as the filter function argument.
Set<String> strSet = new HashSet<String>();
strSet.add("Value");
strSet.add("value");
strSet.add("ValuE");
strSet.add("valuE");
Predicate<String> capStartFilter = (p) -> (p.charAt(0) < 90);
strSet.stream().filter(capStartFilter).noneMatch(capStartFilter);