• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

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

 
Greenhorn
Posts: 1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 41775
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bas,
Agreed and logged. And welcome to CodeRanch!
 
Ranch Hand
Posts: 31
3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 144
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 41775
887
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 144
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That makes sense. Thanks.
 
Doody calls. I would really rather that it didn't. Comfort me wise and sterile tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic