|
|
|
|
|
by bartonfink
5172 days ago
|
|
If you were writing this in C, you'd return a point as a struct. The Java equivalent of a struct is a class. Write a class to wrap those values and return an instance of that class. Yes, there's overhead there that a struct strictly avoids, but it's the way the language was designed, and it's a much better solution than indexing into an array or collection. As for multiple return, I've never once seen a need for it that couldn't be solved by creating ad-hoc MethodReturnValue classes that wrapped everything I wanted to return multiply. |
|