"I would like to add that in Java 17, you can use records to create immutable structures (including tuples). Additionally, Java Tuples have already been implemented and are more powerful in third-party libraries that you can use, such as:
- javatuples https://mvnrepository.com/artifact/org.javatuples/javatuples/1.2
- jmmo tuples https://mvnrepository.com/artifact/org.jmmo/tuples/1.4
- moonshine-tuple https://mvnrepository.com/artifact/io.github.ololx.moonshine/moonshine-tuple/0.13.0
- and others.