HashSet

cats.collections.HashSet
See theHashSet companion object
final class HashSet[A]

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
trait IterableOnce[A]
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

final def ===(that: HashSet[A]): Boolean

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 and that are equal, false otherwise.

Source
HashSet.scala
final def add(value: A): HashSet[A]

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
final def contains(value: A): Boolean

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 contains value, false otherwise.

Source
HashSet.scala
final def diff(set: HashSet[A]): HashSet[A]

Attributes

Source
HashSet.scala
final def diff(iterable: IterableOnce[A]): HashSet[A]

Attributes

Source
HashSet.scala
final override def equals(that: Any): Boolean

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
final def filter(f: A => Boolean): HashSet[A]

Attributes

Source
HashSet.scala
final def filterNot(f: A => Boolean): HashSet[A]

Attributes

Source
HashSet.scala
final def foreach[U](f: A => U): Unit

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
final override def hashCode(): Int

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
final def intersect(set: HashSet[A]): HashSet[A]

Attributes

Source
HashSet.scala
final def isEmpty: Boolean

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
final def iterator: Iterator[A]

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
final def nonEmpty: Boolean

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
final def remove(value: A): HashSet[A]

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
final def show(implicit show: Show[A]): String

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
final def size: Int

The size of this set.

The size of this set.

Attributes

Returns

the number of elements in this set.

Source
HashSet.scala
def toSet: Set[A]

Attributes

Source
HashSet.scala
final override def toString(): String

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
final def union(set: HashSet[A]): HashSet[A]

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
final def union(iterable: IterableOnce[A]): HashSet[A]

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

final def intersect(set: Set[A]): HashSet[A]

Attributes

Inherited from:
HashSetCompat (hidden)
Source
HashSetCompat.scala
override def knownSize: Int

Attributes

Definition Classes
HashSetCompat -> IterableOnce
Inherited from:
HashSetCompat (hidden)
Source
HashSetCompat.scala
def stepper[S <: Stepper[_]](implicit shape: StepperShape[A, S]): S

Attributes

Inherited from:
IterableOnce

Implicits

Implicits

implicit val hash: Hash[A]

Attributes

Source
HashSet.scala