If you just want multiple return/assignment there are quite a few ways
to deal with the problem. One common way is to try to just push
multiple values on the stack. But I think the design of the current
JVM pretty much limits you to using TupleN classes, a list structure,
or arrays. Still, there are advantages to TupleN classes. For
example the classes can support methods beyond just unpacking the
fields, instances can be used via non-Java JVM languages without
necessarily changing those languages, etc.
By the way, Scala makes tuples pleasant by sprinkling a tiny bit of
syntactic sugar over TupleN classes so that (a,b,c) syntax works as a
shortcut for Tuple3(a,b,c). But it turns out that multiple assignment
in Scala is just one case of a general construct in the language. You
can write
case class Person(id : Int, name : String, age : Int)
def lookupPerson(id : Int) : Person = // some person lookup code
val Person(_, name, age) = lookupPerson(1)
println("person with id 1 has name " + name + " and age " + age)
This code
1) Declares that we want to be able to unpack and match instances of
Person (that's what "case class" means)
2) Looks up the person
3) Unpacks the resulting person into the name and age variables (the
underscore says skip the id since we already know it).
4) Prints the name and age
In Scala the multiple assignment
val (a,b,c) = (1,2,3)
is just sugar over
val Tuple3(a,b,c) = Tuple3(1,2,3)
And that in turn is just one case of a generalized pattern matching
mechanism that's available to you and your code as shown in the Person
example.