Given the code fragment:
List str = Arrays.asList (''my'', ''pen'', ''is'', ''your', ''pen'');
Predicate test = s -> {
int i = 0;
boolean result = s.contains (''pen'');
System.out.print(i++) + '':'');
return result;
};
str.stream()
.filter(test)
.findFirst()
.ifPresent(System.out ::print);
What is the result?
Limited Time Offer
25%
Off
Bethanie
3 days ago