Posts Tagged: java.util

Goodies in Groovy from DefaultGroovyMethods

Posted by & filed under , .

If you ever programmed in Groovy language, you probably “enjoyed” (maybe without realising) the joys of DefaultGroovyMethods. What you probably don’t realise is that you can override these methods to customize your classes — and occasionally generate some code that’s not that easy to read. (Do you remember the old C++ way of overriding operators […]

Java Map and Subtleties of getOrDefault vs computeIfAbsent

Posted by & filed under , .

I wrote recently about the new niceties in the Map interface that Java 8 brought to light where I’m highlighting in particular 2 new methods: getOrDefault and computeIfAbsent (see my previous post here about it). These provide a cleaner (and as it turns out faster too!) way of retrieving values from a Map instance. However, […]

Java 8 — Map and the Unknown “Niceties”

Posted by & filed under , .

Despite Java 9 making its way into the real world nowadays, I see a lot of Java code out there still relying on the old-style Java 6-like syntax. And I’m not talking about the usage of lambda’s, stream’s and the likes, but rather some of the improvements Java 8 brought to existing classes in the […]