I have this piece of code:
boolean anyMatch = ifxStopChkInqRs.getBankSvcRs().stream().anyMatch(
b -> b.getStopChkInqRs().stream().anyMatch(
i -> i.getStopChkRec().stream()
.filter(d -> d.getStopChkInfo().getDesc().equals("D"))
.findFirst()
.isPresent()));
This returns a true/false value correctly, and quits at the first object it finds if any.
But, how can I return the object itself, which in this case would be of type StopChkRec - the i object? I changed both anyMatch to peek and a added a get() in front of findFirst(), but that returned a stream at the highest level - Stream<BankSvcRs> - which beats the whole search purpose of course.
Any help and/or a re-approach to re-constructing this lambda expression is welcome.