Win a copy of High Performance Python for Data Analytics this week in the Python 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

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: 40400
821
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()!
 
I think I'll just lie down here for a second. And ponder this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic