Given the code fragment:
List<String> str = Arrays.asList ("my", "pen", "is", "your', "pen");
Predicate<String> 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?
Destroyer
Highly Voted 4 years, 12 months agoSaurabhag
Highly Voted 4 years, 5 months agoasdfjhfgjuaDCV
Most Recent 9 months, 3 weeks agosteefaand
10 months, 3 weeks agoiSnover
11 months, 1 week agor1muka5
1 year, 9 months agowheredajuice
2 years, 9 months agoWilsonKKerll
2 years, 9 months ago