Java 8 - Method Reference

Method and Constructor Reference

Hello!

This post is from the Java 8 Series!

Method Reference with Static Methods

Using NumberDiscovery class with Anonymous class:

Using Lambda Expression:

The Method Reference pattern for Static Methods is the following:

Classic Lambda Expression

To Method Reference:

In our case, will be

Then, using Method Reference \o/

Method Reference with Instance Objects

That's it! I hope that this Java 8 Tutorial would be useful to you!

Thanks!

Follow us to keep up to date! \o/

Alexandre Gama

Alexandre Gama

Hacking Code Founder

Hacking Code Founder and Writer, Passionate Senior Software Engineer and Team Leader at @Elo7, Teacher of several courses at Caelum, Speaker at many conferences and terrible guitar player.
Java 8 - Lambda Expression - Java Tutorial Hacking Code

Java 8 - Lambda Expression

Do you know how to use Java 8 Lambda Expressions? No? Let's see it!
Java 8 - Default Methods - Java Tutorial Hacking Code

Java 8 - Default Methods Tutorial

Did you know that now we can have non-abstract methods in Interfaces? Let's see why!
Java 8 - Functions - Java Tutorial Hacking Code

Java 8 - Functions

Do you want to try a more Functional Programming Style with Functions?
Java 8 - Method Reference - Java Tutorial Hacking Code

Java 8 - Method Reference

Method Reference is a really awesome feature from Java 8! Let's see why and how to use it!
Java 8 - Stream Count - Java Tutorial Hacking Code

Java 8 - Stream Match Tutorial

Stop suffering and let's use Java 8 Stream Count!
Java 8 - Stream Filter - Java Tutorial Hacking Code

Java 8 - Stream Filter

Filtering data with Stream Filter from Java 8
Java 8 - Stream Map - Java Tutorial Hacking Code

Java 8 - Stream Map

Updating data with Stream Map from Java 8
Java 8 - Stream Sorted - Java Tutorial Hacking Code

Java 8 - Stream Sorted

Sorted Collections with Java 8 Stream Sorted
Java 8 - Stream Match - Java Tutorial Hacking Code

Java 8 - Stream Match Tutorial

Let's see if any data Match with rules using Stream Match from Java 8!
Java 8 Stream Reduce Tutorial - Java Guide by Live Coding

Java 8 - Stream Reduce Tutorial

Let's move on and reduce some data with Stream Reduce from Java8!
Java 8 Consumer Tutorial - Java Guide by Live Coding

Java 8 - Consumers Tutorial

Java 8 Consumers - Making our life easier!
Java 8 Predicate Tutorial - Java Guide by Live Coding

Java 8 - Predicate Tutorial

Java 8 Predicate - An important built-in Functional Interface!
Java 8 Comparator Tutorial - Java Guide by Live Coding

Java 8 - Comparator Tutorial

Java 8 Comparator is known from old times...Let's see what has changed!
Java 8 Supplier Tutorial - Java Guide by Live Coding

Java 8 - Supplier Tutorial

Java 8 Suppliers become an easy Functional Interface to like!

0 Comments

Trackbacks/Pingbacks

  1. Java 8 – Lambda Expression | Hacking Code - […] 5 […]

Leave a Reply

Share This
Subscribe To Our Newsletter

Subscribe To Our Newsletter

Join our mailing list to receive the latest news and updates from our team.

You have Successfully Subscribed!

%d bloggers like this: