I have two arrays:
GlobalArray:Array(Int,Array[String])
and SpecificArray:Array(Int,Int)
.
The first Int
in both of them is a key and I would like to get the element corresponding to that key from the GlobalArray
.
In pseudocode:
val v1
For each element of SpecificArray
Get the corresponding element from GlobalArray to use its Array[String]
If (sum <= 100)
for each String of the Array
update v1
// ... some calculation
sum += 1
println (v1)
I know using .map()
I could go through each position of the SpecificArray
, but so far I was able to do this:
SpecificArray.map{x => val in_global = GlobalArray.filter(e => (e._1 == x._1))
// I don't know how to follow
}