Creates a new IntMap
with specified default values and initial buffer size.
Creates a new IntMap
with an initial buffer of specified size.
Creates a new IntMap
with an initial buffer of specified size.
A IntMap can typically contain half as many elements as its buffer size before it requires resizing.
Creates a new IntMap
that returns default values according to a supplied key-value mapping.
(Changed in version 2.8.0) +
creates a new map. Use +=
to add an element to this map and return that map itself.
Adds a new key/value pair to this map and returns the map.
(Changed in version 2.8.0) -
creates a new map. Use -=
to remove an element from this map and return that map itself.
(Changed in version 2.8.0) -
creates a new map. Use -=
to remove an element from this map and return that map itself.
(Changed in version 2.8.0) --
creates a new map. Use --=
to remove an element from this map and return that map itself.
Retrieves the value associated with a key.
Retrieves the value associated with a key.
If the key does not exist in the map, the defaultEntry
for that key
will be returned instead.
The user-supplied default value for the key.
The user-supplied default value for the key. Throws an exception if no other default behavior was specified.
Applies a function to all keys of this map.
Applies a function to all values of this map.
Retrieves the value associated with a key, or the default for that type if none exists (null for AnyRef, 0 for floats and integers).
Retrieves the value associated with a key, or the default for that type if none exists (null for AnyRef, 0 for floats and integers).
Note: this is the fastest way to retrieve a value that may or
may not exist, if the default null/zero is acceptable. For key/value
pairs that do exist, apply
(i.e. map(key)
) is equally fast.
(Changed in version 2.8.0) keys
returns Iterable[A]
rather than Iterator[A]
.
Repacks the contents of this IntMap
for maximum efficiency of lookup.
Repacks the contents of this IntMap
for maximum efficiency of lookup.
For maps that undergo a complex creation process with both addition and
removal of keys, and then are used heavily with no further removal of
elements, calling repack
after the end of the creation can result in
improved performance. Repacking takes time proportional to the number
of entries in the map.
(Changed in version 2.9.0) The behavior of scanRight
has changed. The previous behavior can be reproduced with scanRight.reverse.
(Changed in version 2.9.0) transpose
throws an IllegalArgumentException
if collections are not uniformly sized.
Updates the map to include a new key-value pair.
Updates the map to include a new key-value pair.
This is the fastest way to add an entry to a IntMap
.
(Changed in version 2.8.0) values
returns Iterable[B]
rather than Iterator[B]
.