How can the following be converted to scala? If I live it as it is, I'm getting a big type mismatch expected
.entrySet().forEach(entry -> {..})
I tried specifying entry to java.util.Map.Entry, or changing to scala foreach, doesn't work.
Let me know if you need any more info/code, and I'll create some dummy example since I'm not allowed to post the exact code.
check this
Iterating over Java collections in Scala
for each in scala
for(entry<-entrySet){
//
}
or
entrySet.foreach{entry=>
//
}
or
.entrySet.map{entry =>
//
}
Just
import scala.collection.JavaConversions._
for an implicit conversion to scala collections.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With