KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the idiomatic way of a getOrElseUpdate for immutable.Map instances?. I use the snippet below, but it seems verbose and inefficient var map = Map[Key, Value]() def foo(key: Key) = { val value = map.getOrElse(key, new Value) map += key -> value value }
Tags (comma-separated)
Save Edits
Cancel