• 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
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
  • paul wheaton
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Rob Spoor
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:

Errata for OCP Java 8: Chapter 4

 
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 181 after the first bullet point list: "is" should be removed from the following sentence

"Think about your answer is before continuing."



On page 192 after the code example for allMatch(), anyMatch() and noneMatch() is the following explanation

anyMatch() returns true because two of the three elements match. allMatch() returns false because one doesn't match. noneMatch() also returns false because one matches.


The explanation for noneMatch() should be "also returns false because two match."
 
author & internet detective
Posts: 41763
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
For 181, I intended it to say "Think about what your answer is" so I put that way in the errata. Still missing/extra word though!

For 192, the sentence in the book is actually right. While there would be two matches, Java stops looking after the first one. noneMatch() is kind of like a short circuit operator. If you have false && second(), the second() condition never would get called. With noneMatch(), Java sees one that matches and says "ok, clearly it is false that none match so I'll stop working on that now."
 
Kilian Reisenegger
Greenhorn
Posts: 4
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're right, could be a missing or an extra word

Thanks for the clarification of noneMatch()!
 
Happily living in the valley of the dried frogs with a few tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic