Simple immutable hash map implementation intended for use-cases where the number of entries is known to be small. This implementation is backed by a single array and uses open addressing with linear probing to resolve conflicts. The underlying array is created to exactly fit the data size so hash collisions tend to be around 50%, but have a fairly low number of probes to find the actual entry. With a cheap equals function for the keys lookups should be fast and there is low memory overhead.
You probably don't want to use this implementation if you expect more than around 50 keys in the map. If you have millions of small immutable maps, such as tag data associated with metrics, it may be a good fit.
Value parameters
- data
-
array with the items
- dataLength
-
number of pairs contained within the array starting at index 0.
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
trait Map[K, V]trait MapOps[K, V, Map, Map[K, V]]trait Map[K, V]trait Equalstrait MapFactoryDefaults[K, V, Map, Iterable]trait MapOps[K, V, Map, Map[K, V]]trait PartialFunction[K, V]trait K => Vtrait Iterable[(K, V)]trait Iterable[(K, V)]trait IterableFactoryDefaults[(K, V), Iterable]trait IterableOps[(K, V), Iterable, Map[K, V]]trait IterableOnceOps[(K, V), Iterable, Map[K, V]]trait IterableOnce[(K, V)]class Objecttrait Matchableclass AnyShow all
Members list
Value members
Concrete methods
Returns a wrapper that adheres to the java Map interface. This wrapper helps to avoid unnecessary allocation of Option
Returns a wrapper that adheres to the java Map interface. This wrapper helps to avoid unnecessary allocation of Option
Attributes
Attributes
- Definition Classes
-
MapOps
Overridden to get better performance. See SmallHashMapEquals benchmark for a comparison with the default for various inputs.
Overridden to get better performance. See SmallHashMapEquals benchmark for a comparison with the default for various inputs.
Attributes
- Definition Classes
-
Map -> Equals -> Any
Attributes
- Definition Classes
-
IterableOnceOps
Call the function f
for each tuple in the map without requiring a temporary object to be created.
Call the function f
for each tuple in the map without requiring a temporary object to be created.
Attributes
- Definition Classes
-
MapOps
Attributes
- Definition Classes
-
MapOps
Overridden to get better performance. See SmallHashMapHashCode benchmark for a comparison with the default for various inputs.
Overridden to get better performance. See SmallHashMapHashCode benchmark for a comparison with the default for various inputs.
Attributes
- Definition Classes
-
Map -> Any
Constant time operation to check if the map is empty
Constant time operation to check if the map is empty
Attributes
- Definition Classes
-
IterableOnceOps
Attributes
- Definition Classes
-
MapOps
Returns the number of keys that are not in the correct position based on their hash code.
Returns the number of keys that are not in the correct position based on their hash code.
Attributes
Returns the average number of probes that are required for looking up keys in this map. In general we want this number to be less than N/4. If we naively did a linear scan of the full data it would be N/2.
Returns the average number of probes that are required for looking up keys in this map. In general we want this number to be less than N/4. If we naively did a linear scan of the full data it would be N/2.
Attributes
Constant time operation to get the number of pairs in the map.
Constant time operation to get the number of pairs in the map.
Attributes
- Definition Classes
-
IterableOnceOps
Attributes
- Definition Classes
-
MapOps
Deprecated methods
Call the function f
for each tuple in the map without requiring a temporary object to be created.
Call the function f
for each tuple in the map without requiring a temporary object to be created.
Attributes
- Deprecated
- true
Inherited methods
Attributes
- Definition Classes
-
MapOps -> MapOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapOps -> MapOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
MapOps -> IterableOnceOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
PartialFunction -> Function1
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapOps -> PartialFunction
- Inherited from:
- MapOps
Attributes
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- Function1
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
Iterable -> Iterable -> IterableOps
- Inherited from:
- Iterable
Attributes
- Definition Classes
-
MapOps -> MapOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnce
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- Iterable
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
Map -> Map -> MapOps
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnce
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Definition Classes
-
IterableOps -> IterableOnceOps
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Definition Classes
-
Map -> IterableOnceOps
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- IterableOnceOps
Returns a string representation of the object.
Returns a string representation of the object.
The default representation is platform dependent.
Attributes
- Returns
-
a string representation of the object.
- Definition Classes
-
Map -> Function1 -> Iterable -> Any
- Inherited from:
- Map
Attributes
- Inherited from:
- IterableOnceOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- PartialFunction
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Inherited from:
- MapOps
Attributes
- Definition Classes
-
MapOps -> IterableOps
- Inherited from:
- MapOps
Attributes
- Inherited from:
- Map
Attributes
- Inherited from:
- Map
Attributes
- Definition Classes
-
MapFactoryDefaults -> IterableOps
- Inherited from:
- MapFactoryDefaults
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Attributes
- Inherited from:
- IterableOps
Deprecated and Inherited methods
Attributes
- Deprecated
-
[Since version 2.13.0]
Use ++ with an explicit collection argument instead of + with varargs - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use ++ instead of ++: for collections of type Iterable - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use ++ instead of ++: for collections of type Iterable - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use -- with an explicit collection - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use foldLeft instead of /: - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use foldRight instead of :\\ - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
`aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead. - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use iterableFactory instead - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use `dest ++= coll` instead - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.filterKeys(f). A future version will include a strict version of this method (for now, .view.filterKeys(p).toMap). - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details) - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.mapValues(f). A future version will include a strict version of this method (for now, .view.mapValues(f).toMap). - Inherited from:
- MapOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use coll instead of repr in a collection implementation, use the collection value itself from the outside - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Iterable.seq always returns the iterable itself - Inherited from:
- Iterable
Attributes
- Deprecated
-
[Since version 2.13.7]
toIterable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections - Inherited from:
- Iterable
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .iterator instead of .toIterator - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .to(LazyList) instead of .toStream - Inherited from:
- IterableOnceOps
Attributes
- Deprecated
-
[Since version 2.13.0]
toTraversable is internal and will be made protected; its name is similar to `toList` or `toSeq`, but it doesn\'t copy non-immutable collections - Inherited from:
- IterableOps
Attributes
- Deprecated
-
[Since version 2.13.0]
Use .view.slice(from, until) instead of .view(from, until) - Inherited from:
- IterableOps