8291954: Use Optional.isEmpty instead of !Optional.isPresent in java.base

Reviewed-by: jpai, alanb, lancea, rriggs, bpb
This commit is contained in:
Andrey Turbanov 2022-08-06 09:53:35 +00:00
parent 87cda21c5d
commit ae52053757
6 changed files with 21 additions and 23 deletions

View file

@ -6780,7 +6780,7 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
loopReturnType + ")");
}
if (!pred.stream().filter(Objects::nonNull).findFirst().isPresent()) {
if (pred.stream().noneMatch(Objects::nonNull)) {
throw newIllegalArgumentException("no predicate found", pred);
}
if (pred.stream().filter(Objects::nonNull).map(MethodHandle::type).map(MethodType::returnType).