DEV Community

sbourke
sbourke

Posted on

3

Java Syntax question

The last time I used Java was 1.5, could someone let me know what the ::new does ?

namedWriteables.add(new NamedWriteableRegistry.Entry(EvaluationMetric.class, RecallAtK.NAME, RecallAtK::new));

Top comments (2)

Collapse
 
clementdeb profile image
clementDeb

Hello,
it creates a new instance of RecallAtK

Collapse
 
smuschel profile image
smuschel

Java came a long way since version 5. Java 8 introduced method references, see baeldung.com/java-method-references for examples...

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay