Posts Tagged: core java

Scripting

Java, Map and Optional

Posted by & filed under , .

I do like the Optional class in Java — it is a long awaited elegant replacement for returning null whenever something isn’t there then relying on if( x != null ) checks or using ?: in the format (x == null) ? “foo” : “bar”. It works great also with the new Java stream classes […]

Java 8 Accumulators and Adders

Posted by & filed under , , , .

If you’ve been using Java for a while now, then like me, you must have saluted the move quite a while back in JDK 1.5 to introduce the atomic classes (AtomicLong, AtomicBoolean and so on). They were a big step forward, away from the clunkyness of having to create ridiculous bottlenecks in the code for […]

Small Java Utility to Generate Random int Files

Posted by & filed under , , , .

This is not ground-breaking, folks and in fact it’s not even anything sexy, but it’s just something that’s been bugging me for a while when I play with some Java tools and code on my side: I need (very) often a way to quickly generate a text file with random integers as well as a […]