Skip to content

Item 43: Prefer method references to lambdas #2

@gbaswath

Description

@gbaswath

Highlights

The primary advantage of lambda over anonymous class in creating function object is that it is more succinct. Java 8 also provides a way to generate function object even more succinct through method references.

  • Lambda expression as function objects
  • Method reference as function objects
  • Identity Function
  • Method Reference Types
  • Disadvantages
  • Summary

Reference

  1. MethodReferenceExample.java
  2. MethodReferenceExampleTest.java

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions