This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Journey To Enterprise Agility and have Daryl Kulak & Hong Li on-line!
See this thread for details.
Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • 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:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Possible errata in OCP study book  RSS feed

 
Greenhorn
Posts: 4
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, im studying to get the OCP Java 8 certification.

I'm readinn the book "OCP Oracle Certified Professional Java SE 8 Programmer II Study Guide, by Jeanne Boyarsky and Scott Selikoff"

I have a doubt, in page 59, there is a lambda example, that I think that there is no possible way to assign it to a Functional Interface:




For example, the next lambda expression:



can be successfully asigned to a IntConsumer:



greetings

Jaime Reyes

 
Master Rancher
Posts: 2758
93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Jaime,

welcome to the Ranch and enjoy the stay!

I think you are correct. I could not come up with code that accepted

The 'int' must be replaced by 'Integer'.
The Functional Interface is here a BiFunction, for instance

Replacing Integer by int gives an error.
 
Jaime Rebel Gaiden
Greenhorn
Posts: 4
1
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I was just focusing on already created Functional Interfaces, but, I found there is a way to make it compile successfully:



an the caller

 
Piet Souris
Master Rancher
Posts: 2758
93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right. Have a cow!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!