DEV Community

sbourke
sbourke

Posted on

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...