An immutable hash set using cats.kernel.Hash for hashing.
Implemented using the CHAMP encoding.
Type parameters
- A
-
the type of the elements contained in this hash set.
Value parameters
- hash
-
the cats.kernel.Hash instance used for hashing values.
Attributes
- See also
- Companion
- object
- Source
- HashSet.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.HashSet values of the same element 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
- that
-
the cats.data.HashSet to check for equality with this set.
Attributes
- Returns
-
true
if this set andthat
are equal,false
otherwise. - Source
- HashSet.scala
Creates a new set with an additional element, unless the element is already present.
Creates a new set with an additional element, unless the element is already present.
Value parameters
- value
-
the element to be added.
Attributes
- Returns
-
a new set that contains all elements of this set and that also contains
value
. - Source
- HashSet.scala
Test whether the set contains value
.
Test whether the set contains value
.
Value parameters
- value
-
the element to check for set membership.
Attributes
- Returns
-
true
if the set containsvalue
,false
otherwise. - Source
- HashSet.scala
Attributes
- Source
- HashSet.scala
Attributes
- Source
- HashSet.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
- HashSet.scala
Attributes
- Source
- HashSet.scala
Attributes
- Source
- HashSet.scala
Apply f
to each element for its side effects.
Apply f
to each element for its side effects.
Value parameters
- f
-
the function to apply to each element.
Attributes
- Source
- HashSet.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
- HashSet.scala
Attributes
- Source
- HashSet.scala
Tests whether the set is empty.
Tests whether the set is empty.
Attributes
- Returns
-
true
if the set contains no elements,false
otherwise. - Source
- HashSet.scala
An iterator for this set that can be used only once.
An iterator for this set that can be used only once.
Attributes
- Returns
-
an iterator that iterates through the elements of this set.
- Source
- HashSet.scala
Tests whether the set is not empty.
Tests whether the set is not empty.
Attributes
- Returns
-
true
if the set contains at least one element,false
otherwise. - Source
- HashSet.scala
Creates a new set with the given element removed from this set.
Creates a new set with the given element removed from this set.
Value parameters
- value
-
the element to be removed.
Attributes
- Returns
-
a new set that contains all elements of this set but that does not contain
value
. - Source
- HashSet.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
- show
-
the cats.Show instance to use for showing values of type
A
.
Attributes
- Returns
-
a java.lang.String representation of this set.
- Source
- HashSet.scala
The size of this set.
Attributes
- Source
- HashSet.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
- HashSet.scala
Creates a new set with all of the elements of both this set and the provided set
.
Creates a new set with all of the elements of both this set and the provided set
.
Value parameters
- set
-
the set whose values should be added to this set.
Attributes
- Returns
-
a new set that contains all elements of this set and all of the elements of
set
. - Source
- HashSet.scala
Creates a new set with all of the elements of both this set and the provided iterable
.
Creates a new set with all of the elements of both this set and the provided iterable
.
Value parameters
- set
-
the iterable whose values should be added to this set.
Attributes
- Returns
-
a new set that contains all elements of this set and all of the elements of
iterable
. - Source
- HashSet.scala
Inherited methods
Attributes
- Inherited from:
- HashSetCompat (hidden)
- Source
- HashSetCompat.scala
Attributes
- Definition Classes
-
HashSetCompat -> IterableOnce
- Inherited from:
- HashSetCompat (hidden)
- Source
- HashSetCompat.scala
Attributes
- Inherited from:
- IterableOnce
Implicits
Implicits
Attributes
- Source
- HashSet.scala