Guest User

Untitled

a guest
May 20th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. val v1
  2. For each element of SpecificArray
  3. Get the corresponding element from GlobalArray to use its Array[String]
  4. If (sum <= 100)
  5. for each String of the Array
  6. update v1
  7. // ... some calculation
  8. sum += 1
  9.  
  10. println (v1)
  11.  
  12. SpecificArray.map{x => val in_global = GlobalArray.filter(e => (e._1 == x._1))
  13. // I don't know how to follow
  14. }
  15.  
  16. val globalMap = GlobalArray.toMap
  17.  
  18. println(SpecificArray.flatMap({case (k,v) => globalMap(k).map(s => (k,v,s))}).toList)
  19.  
  20. println(SpecificArray.flatMap({case (k,v) => globalMap(k)}).toList)
  21.  
  22. println(SpecificArray.flatMap({case (k,v) => globalMap.getOrElse(k, Array()).map(s => (k,v,s))}).toList)
Add Comment
Please, Sign In to add comment