Scala multiple assignment to existing variable

前端 未结 5 727
独厮守ぢ
独厮守ぢ 2021-01-11 17:02

I can do something like

def f(): Tuple2[String, Long] = ...
val (a, b) = f()

What about if the variables are already existing? I\'m runnin

5条回答
  •  天命终不由人
    2021-01-11 17:33

    If you run always "the same sets of data" over filters etc, it is a symptom that they belong somehow together, so you should consider to group them using either a tuple or a dedicated class (usually a case class in such cases).

提交回复
热议问题