Background:
A Tuple utility for Java.
Tuple2<String, Integer> output = getNameAndAge();
public Tuple2<String, Integer> getNameAndAge() {
return tup.of("Luigi", 420);
}
This allows for multiple values to be returned from methods without having to create single-use records every time.
It also allows the coder to express obvious associations. So instead of passing 8 params into a function where the first 4 correspond to 1 logical entity and the second 4 correspond to the other one, we can pass in two Tuple4's, so that their association is made explicit.
Code:
https://github.com/raagnair/jbelt/blob/main/src/main/java/com/raagnair/belt/TupleTools.java