Language warning.
Some articles are available in English but most of them are only available in French up to now (2026).
Thanx to modern LLM like Claude, they should be translated in a near future.
Guru Meditation #00000004.0000AAC0
// Nothing prevents calling this in reverse order. The compiler says nothing.
public User createUser(String firstName, String lastName, String email, String phone) { /*...*/ }
This is the kind of code we’ve been writing for years without questioning it. And yet there’s a potential bug in every single call: the parameter order. But there’s worse: these four String values don’t represent the same thing. A first name, a last name, an email address, a phone number — these are distinct business concepts, each with their own validation rules and constraints. And you’re representing all of them with the same type.
This is the code smell known as Primitive Obsession. And since Java 16, we have no excuse for letting it linger.
Everyone knows (or should know) the Collections API provided by the JDK, especially the high-level interfaces: Collection, Map, and certainly the specialized ones like List or Set.
Although it received a slight facelift with Java 8, mostly thanks to (or because of) the Stream API, this historical API still suffers from various gaps and an sometimes painful verbosity.
It is therefore quite common to see Guava or Apache Commons Collections added to a project’s dependencies, each with their own drawbacks: Guava brings everything along (including what you don’t need), and Apache Commons Collections does not support lambdas, having been designed before Java 8.
So I’m going to present Eclipse Collections, a lightweight, performant and really effective API that deserves to be better known. And I’ll show you concretely why, once you get a taste of it, you don’t go back.
If, like me, you are tired of making command line programs in Java and having to run them with this kind of things:
$ java -jar demo-app-v1.0.0-SNAPSHOT.jar arg1 arg2 arg3`
This little article should please you.
You will then be able to do this directly:
$ ./demo-app arg1 arg2 arg3
Appetizing!
In this little tutorial, I will generate an executable file :
- for Linux and MacOSX,
- for Windows, an
.EXE,
- as a classic Runnable JAR.
However, this requires the presence of a JAVA Runtime (JRE and/or JDK) on the machine that will run it, although there are also solutions to embed a JRE.
The solutions I will describe do not use GRAALVM and its native compilation.
Java 12 was released on 20/03/19, bringing a new way to write switch/case control structures.
This gave me an idea, admittedly a bit strange, to revisit the traditional switch/case from a
functional programming point of view by using lambdas and a small Switch class, all in JAVA 8!
Be careful though, it is certain that this approach is much less efficient than a classic switch/case,
but I don’t give up the beauty of the gesture.
Versions of this article:
- 04/10/2019: first publication.
- 26/02/2020 : following a judicious idea posted on “developpez.com” forums, see the “Let’s go further …” part.
I will present in this post the Lombok library which I’m currently using for quite every development in Java. After 4 years dealing with it, I wish I could share some experience and give some advice.
As an excerpt, here is my best : don’t use @Data but you’ll need to be patient and to read the conclusion to know why.