You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As noted by @smarterhere, builders for Maps just use the regular Builder interface, and do not expose a way to add elements without creating tuples. However, several of the implementations (which are not publicly accessible) do have addOne methods taking key and value parameters.
The text was updated successfully, but these errors were encountered:
What's more concerning to me is how Map creates a Tuple2 for every MapNode iteration, like map, foreach etc. for most Map implementation.
In HashMap, MapKeyValueTupleIterator creates a Tuple2 for every pair during iteration. So if you do a map on a HashMap with 1000 elements, it creates additional 1000 Tuple2 (if there is no collision because that's a different node impl)
Scala 2.13.x
As noted by @smarter here, builders for
Map
s just use the regularBuilder
interface, and do not expose a way to add elements without creating tuples. However, several of the implementations (which are not publicly accessible) do haveaddOne
methods takingkey
andvalue
parameters.The text was updated successfully, but these errors were encountered: