Skip to content
Advertisement

Tag: java-14

Can JavaFX realistically be used in a non-modular environment?

I’ve attempted to use JavaFX by following instructions found at: https://openjfx.io/openjfx-docs/ under “JavaFX and IntelliJ” -> “Non-modular with Maven” After completing steps 1 & 2 (Installation & Verification) I attempted to run a very simple program from IntelliJ rather than through the Maven plugin. TraderWindow.java TraderWindow.fxml However when I attempted to run it I got: The relevant part: Which, I

Convert one Optional<List> to another Optional<List> in Java

How can I convert Optional List object from one type to another, for an example ProductMultipleOptionViewModel Type 1 Type 2 I want to convert from Optional<List<ProductMultipleOption>>to other Optional<List<ProductMultipleOptionViewModel>>. I tried the below code With the above code, I am not able to access the option value inside map method If product.getProductMultipleOption() is null return null or empty list. Answer You

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.

Lombok getter/setter vs Java 14 record

I love project Lombok but in these days I’m reading and trying some of the new features of java 14. Inside the new capability, there is the record keyword that allows creating a class with already built-in the following functionality: constructor, private final fields, accessors, equals/hashCode, getters, toString methods. Now my question is: is better to rely on the feature

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

Advertisement