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

Create an Account!

👀 Just want to lurk?

That's fine, you can still create an account and turn on features like 🌚 dark mode.