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, 7 months agoSaurabhag
Highly Voted 4 years agoasdfjhfgjuaDCV
Most Recent 4 months, 3 weeks agosteefaand
5 months, 3 weeks agoiSnover
6 months, 1 week agor1muka5
1 year, 4 months agowheredajuice
2 years, 4 months agoWilsonKKerll
2 years, 4 months ago