This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin for Android App Development and have Peter Sommerhoff on-line!
See this thread for details.
Win a copy of Kotlin for Android App Development this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Errata for OCP: Oracle Certified Professional Java SE 8 Programmer II Study Guide - page 192 (Sybex)  RSS feed

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code snippet:
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".
 
author & internet detective
Posts: 39129
723
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bas,
Agreed and logged. And welcome to CodeRanch!
 
Ranch Hand
Posts: 31
3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi!

I think there is something a little bit confusing with that paragraph. Granted, it is true that this would terminate:



But this, I think, would not:



And although it is never said in the paragraph that the noneMath() method ALWAYS terminates, the correction may lead someone to (mistakenly) assume that it does (I almost did).

Regards,

Tomás
 
Tomas Castagnino
Ranch Hand
Posts: 31
3
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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"
 
Jeanne Boyarsky
author & internet detective
Posts: 39129
723
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Jorge Ruiz-Aquino
Ranch Hand
Posts: 48
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes sense. Thanks.
 
Why does your bag say "bombs"? The reason I ask is that my bag says "tiny ads" and it has stuff like this:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!