Re:Java 17 / JDK 17: General Availability
by sverhagen on Tuesday September 14, 2021 @05:08PM
(#28531253)
Using the object(/class) as you say is the probably "the Java way" to do this, given their historical "everything is an object" stance (which has been eroded a bit, though, with some of the functional support). But it sure is nice to do a multi-returns, here and there, without having to create another class. A class which required you to write boilerplate (getters/setters). Maybe records are some sort of compromise. Probably a non-compromise for people who like the multi-returns.
What are the benefits of having a multiple return type function?
I just assume that one can use an object if this is needed throughout the whole code..
Or maybe create an arraylist if possible and return that?