Wait, I'm not sure about this. The Predicate is printing multiple index values, but the question asks for a single result. I'll need to think this through carefully.
Okay, I think I've got it. The Predicate is printing the index as a side effect, but the actual return value is whether the string contains "pen". So the result should be the first string that contains "pen".
E) A compilation error occurs. - What? No way, this code looks perfectly fine to me. I think you need to double-check your understanding of Java streams.
User 1: E) A compilation error occurs. - What? No way, this code looks perfectly fine to me. I think you need to double-check your understanding of Java streams.
A) 0 : 0 : pen - This seems like the correct answer. The predicate checks if the string contains 'pen' and prints the value of the counter, which starts at 0 and increments for each match.
Felix
3 months agoKaitlyn
3 months agoCecil
3 months agoOlive
3 months agoYoko
4 months agoTiara
4 months agoViva
4 months agoChun
4 months agoNan
4 months agoLashandra
5 months agoCordelia
5 months agoStefania
5 months agoElvera
5 months agoAsha
5 months agoBeckie
8 months agoKing
8 months agoFrance
8 months agoMignon
7 months agoKati
7 months agoLinwood
8 months agoWillard
7 months agoMargurite
7 months agoLouis
8 months agoSheridan
9 months agoCarey
9 months agoReyes
9 months agoSheridan
9 months agoJoanna
8 months agoBuck
8 months agoAmmie
8 months agoLouvenia
9 months ago