scala - Is there more compact way to convert Map[Any,Any] to Map[String,String]? -


consider code:

def convertmape(map:map[any,any]): map[string,string] = {   map.foldleft(map.newbuilder[string,string]) {(builder,kv)=>     builder += ((kv._1.tostring, kv._2.tostring))   }.result() } 

is there more compact way convert map[any,any] map[string,string] without using map builder?

what about

map.map{case (k,v) => k.tostring -> v.tostring} 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -