r/java • u/RevilTS • Aug 03 '25
Teach Me the Craziest, Most Useful Java Features — NOT the Basic Stuff
I want to know the WILD, INSANELY PRACTICAL, "how the hell did I not know this earlier?" kind of Java stuff that only real devs who've been through production hell know.
Like I didn't know about modules recently
393
Upvotes
View all comments
7
u/[deleted] Aug 03 '25
Double brace initialization:
This actually creates an anonymous subclass of
HashMap(the first set of braces) and second set of braces is an initializer block.I wouldn't call this practical or useful, but it is crazy!