Text: "On the infinite list, one match is found, so the call [to anyMatch()] terminates. If we called noneMatch() or allMatch(), they would run until we killed the program."
This is incorrect. noneMatch() also terminates immediately, returning false. Apart from that, I would say the term "infinite list" is incorrect and should read "infinite stream".
Yes, I realize that first paragraph states that those methods “may or may not terminate for infinite stream”. So there is no errata in there. Mine was just a friendly note on the perhaps confundent (?) feeling I get when reading that section + the corrected errata.
Jorge Ruiz-Aquino wrote:In the last paragraph of allMatch(), anyMatch() and noneMatch().
"noneMatch() also returns false because one matches" should say "noneMatch() also returns false because two match"
It's right as is. As soon as noneMatch() sees a match, it stops looking. There could be one or a million. It's only the first match that matters.