An immutable hash map using cats.kernel.Hash for hashing.
Implemented using the CHAMP encoding.
Type parameters
- K
-
the type of the keys contained in this hash map.
- V
-
the type of the values contained in this hash map.
Value parameters
- hashKey
-
the cats.kernel.Hash instance used for hashing keys.
Attributes
- See also
- Companion
- object
- Source
- HashMap.scala
- Graph
-
- Supertypes
Members list
Value members
Concrete methods
Typesafe equality operator.
Typesafe equality operator.
This method is similar to scala.Any#== except that it only allows two cats.data.HashMap values of the same key-value type to be compared to each other, and uses equality provided by cats.kernel.Eq instances, rather than using the universal equality provided by java.lang.Object#equals.
Value parameters
- eqValue
-
the cats.kernel.Eq instance to use for comparing values.
- that
-
the cats.data.HashMap to check for equality with this map.
Attributes
- Returns
-
true
if this map andthat
are equal,false
otherwise. - Source
- HashMap.scala
Test whether the map contains key
.
Test whether the map contains key
.
Value parameters
- key
-
the key to check for map membership.
Attributes
- Returns
-
true
if the map containskey
,false
otherwise. - Source
- HashMap.scala
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Compares the receiver object (this
) with the argument object (that
) for equivalence.
Any implementation of this method should be an equivalence relation:
- It is reflexive: for any instance x
of type Any
, x.equals(x)
should return true
. - It is symmetric: for any instances x
and y
of type Any
, x.equals(y)
should return true
if and only if y.equals(x)
returns true
. - It is transitive: for any instances x
, y
, and z
of type Any
if x.equals(y)
returns true
and y.equals(z)
returns true
, then x.equals(z)
should return true
.
If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is usually necessary to override hashCode
to ensure that objects which are "equal" (o1.equals(o2)
returns true
) hash to the same scala.Int. (o1.hashCode.equals(o2.hashCode)
).
Value parameters
- that
-
the object to compare against this object for equality.
Attributes
- Returns
-
true
if the receiver object is equivalent to the argument;false
otherwise. - Definition Classes
-
Any
- Source
- HashMap.scala
Apply f
to each key-value pair for its side effects.
Apply f
to each key-value pair for its side effects.
Value parameters
- f
-
the function to apply to each key-value pair.
Attributes
- Source
- HashMap.scala
Get the value associated with key
in this map.
Get the value associated with key
in this map.
Value parameters
- key
-
the key to check for map membership.
Attributes
- Returns
-
A scala.Some containing the value if present, else scala.None.
- Source
- HashMap.scala
Get the value associated with key
in this map, or default
if not present.
Get the value associated with key
in this map, or default
if not present.
Value parameters
- default
-
the value to use in case
key
is not present. - key
-
the key to check for map membership.
Attributes
- Returns
-
the value if present, else
default
. - Source
- HashMap.scala
Compute a hash code value for this map.
Compute a hash code value for this map.
This method is similar to java.lang.Object#hashCode except that it computes a hash code according to cats.Hash instances.
Value parameters
- hashValue
-
the cats.kernel.Hash instance to use for hashing values of type
VV
.
Attributes
- Returns
-
a hash code value for this map.
- Source
- HashMap.scala
Calculate a hash code value for the object.
Calculate a hash code value for the object.
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)
) yet not be equal (o1.equals(o2)
returns false
). A degenerate implementation could always return 0
. However, it is required that if two objects are equal (o1.equals(o2)
returns true
) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)
). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals
method.
Attributes
- Returns
-
the hash code value for this object.
- Definition Classes
-
Any
- Source
- HashMap.scala
Tests whether the map is empty.
Tests whether the map is empty.
Attributes
- Returns
-
true
if the map contains no elements,false
otherwise. - Source
- HashMap.scala
An iterator for this map that can be used only once.
An iterator for this map that can be used only once.
Attributes
- Returns
-
an iterator that iterates through the key-value pairs of this map.
- Source
- HashMap.scala
An iterator for the keys of this map that can be used only once.
An iterator for the keys of this map that can be used only once.
Attributes
- Returns
-
an iterator that iterates through the keys of this map.
- Source
- HashMap.scala
Tests whether the map is not empty.
Tests whether the map is not empty.
Attributes
- Returns
-
true
if the map contains at least one element,false
otherwise. - Source
- HashMap.scala
Creates a new map with the given key removed from the map.
Creates a new map with the given key removed from the map.
Value parameters
- key
-
the key to be removed.
Attributes
- Returns
-
a new map that contains all elements of this map but that does not contain
key
. - Source
- HashMap.scala
Typesafe stringification operator.
Typesafe stringification operator.
This method is similar to java.lang.Object#toString except that it stringifies values according to cats.Show instances.
Value parameters
- showKey
-
the cats.Show instance to use for showing keys of type
K
. - showValue
-
the cats.Show instance to use for showing values of type
V
.
Attributes
- Returns
-
a java.lang.String representation of this map.
- Source
- HashMap.scala
The size of this map.
Attributes
- Source
- HashMap.scala
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
-
Any
- Source
- HashMap.scala
Creates a new map with an additional key-value pair, unless the key is already present, in which case the value for key
is replaced by value
.
Creates a new map with an additional key-value pair, unless the key is already present, in which case the value for key
is replaced by value
.
Value parameters
- key
-
the key to be added.
- value
-
the value to be added.
Attributes
- Returns
-
a new map that contains all key-value pairs of this map and that also contains a mapping from
key
tovalue
. - Source
- HashMap.scala
An iterator for the values of this map that can be used only once.
An iterator for the values of this map that can be used only once.
Attributes
- Returns
-
an iterator that iterates through the values of this map.
- Source
- HashMap.scala
Inherited methods
Creates a new map with all key-value pairs of this map, and all key-value pairs of iterable
.
Creates a new map with all key-value pairs of this map, and all key-value pairs of iterable
.
Value parameters
- iterable
-
the collection of key-value pairs to be added.
Attributes
- Returns
-
a new map that contains all key-value pairs of this map and
iterable
. - Inherited from:
- HashMapCompat (hidden)
- Source
- HashMapCompat.scala
Attributes
- Definition Classes
-
HashMapCompat -> IterableOnce
- Inherited from:
- HashMapCompat (hidden)
- Source
- HashMapCompat.scala
Attributes
- Inherited from:
- IterableOnce
Implicits
Implicits
Attributes
- Source
- HashMap.scala