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

CharAt can't be used as ReferenceMethod ??

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is practice question from the Test Bank?

Q. 40 Why can’t String::charAt be used as a method reference?

The correct answer is : Method references can pass either the instance of the parameter from the lambda but not both.

However, I can use the String::charAt to implement a BiFunction as below?



Can anyone help to verify the answer?
Screen-Shot-2017-07-17-at-22.45.48.png
[Thumbnail for Screen-Shot-2017-07-17-at-22.45.48.png]
 
Greenhorn
Posts: 13
1
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agreed it is an error, already in the errata -- see this post.
 
Max Ma
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Donald Colvin wrote:Agreed it is an error, already in the errata -- see this post.



Thanks Donald.
reply
    Bookmark Topic Watch Topic
  • New Topic