Skip to content

Tag: java-14

Java records with nullable components

I really like the addition of records in Java 14, at least as a preview feature, as it helps to reduce my need to use lombok for simple, immutable “data holders”. But I’m having an issue with the implementation of nullable components. I’m trying to avoid returning null in my codebase to indicate that a value might not be present.

Java 14 records and arrays

Given the following code: It seems, obviously, that array’s toString, equals methods are used (instead of static methods, Arrays::equals,Arrays::deepEquals or Array::toString). So I guess Java 14 Records (JEP 359) don’t work too well with arrays, the respective methods have to be generated with an IDE (which at least in IntelliJ, by default generates “useful” methods, i.e. they use the static