ZSet

zio.prelude.ZSet
See theZSet companion object
final class ZSet[+A, +B]

A ZSet[A, B] is a set of A values where B represents some notion of "how many" A values are included in the set. This can be the number of times each element appears in the set if B is a natural number, the probability associated with an element in the set if B is a rational number, or even whether an element appears at all if B is a boolean.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
ZSet[A, B]

Members list

Value members

Concrete methods

def &[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[A1, B1]

A symbolic alias for intersect.

A symbolic alias for intersect.

Attributes

def &~[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Inverse[subtypeF.Type[B1]]): ZSet[A1, B1]

A symbolic alias for diff.

A symbolic alias for diff.

Attributes

def <*>[B1 >: B, C](that: ZSet[C, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[(A, C), B1]

A symbolic alias for zip.

A symbolic alias for zip.

Attributes

def <>[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[A1, B1]

A symbolic alias for combine.

A symbolic alias for combine.

Attributes

def apply[A1 >: A, B1 >: B](a: A1)(implicit ev: Identity[subtypeF.Type[B1]]): B1

Returns the number of times the specified element appears in the set.

Returns the number of times the specified element appears in the set.

Attributes

def combine[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[A1, B1]

Combines this set with the specified set to produce a new set where the number of times each element appears is the sum of the number of times it appears in this set and the specified set.

Combines this set with the specified set to produce a new set where the number of times each element appears is the sum of the number of times it appears in this set and the specified set.

Attributes

def diff[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Inverse[subtypeF.Type[B1]]): ZSet[A1, B1]

Combines this set with the specified set to produce a new set where the number of times each element appears is the difference between the number of times it appears in this set and the specified set.

Combines this set with the specified set to produce a new set where the number of times each element appears is the difference between the number of times it appears in this set and the specified set.

Attributes

override def equals(that: Any): Boolean

Returns whether this set is equal to the specified set, meaning that the same elements appear in both sets the same number of times.

Returns whether this set is equal to the specified set, meaning that the same elements appear in both sets the same number of times.

Attributes

Definition Classes
Any
def flatMap[B1 >: B, C](f: A => ZSet[C, B1])(implicit ev1: Commutative[subtypeF.Type[B1]], ev2: Commutative[subtypeF.Type[B1]]): ZSet[C, B1]

Creates a new set for each element in this set and combines the resulting sets together. The number of times each element appears will be the sum of the products of the number of times it appeared in the original set and the number of times it appears in each new set.

Creates a new set for each element in this set and combines the resulting sets together. The number of times each element appears will be the sum of the products of the number of times it appeared in the original set and the number of times it appears in each new set.

Attributes

def forEach[G[_] : Covariant, C](f: A => G[C])(implicit evidence$1: IdentityBoth[G], evidence$2: Covariant[G], ev: B <:< Natural): G[MultiSet[C]]
override def hashCode: Int

Returns the hash code of this set.

Returns the hash code of this set.

Attributes

Definition Classes
Any
def intersect[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[A1, B1]

Combines this set with the specified set to produce a new set where the number of times each element appears is the minimum of the number of times it appears in this set and the specified set.

Combines this set with the specified set to produce a new set where the number of times each element appears is the minimum of the number of times it appears in this set and the specified set.

Attributes

def map[B1 >: B, C](f: A => C)(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[C, B1]

Transforms the elements in the set using the specified function. If this results in mapping two or more elements to the same values, the number of times the new value appears in the set will be the sum of the number of times each of the old values appeared in the set.

Transforms the elements in the set using the specified function. If this results in mapping two or more elements to the same values, the number of times the new value appears in the set will be the sum of the number of times each of the old values appeared in the set.

Attributes

def toMap[A1 >: A]: Map[A1, B]

Converts this set to a Map from elements to how many times they appear in the set.

Converts this set to a Map from elements to how many times they appear in the set.

Attributes

Converts this set to a non-empty one.

Converts this set to a non-empty one.

Attributes

def toSet[A1 >: A, B1 >: B](implicit ev1: Equal[B1], ev2: Identity[subtypeF.Type[B1]]): Set[A1]

Converts this set to a Set, discarding information about how many times an element appears in the set beyond whether it appears at all.

Converts this set to a Set, discarding information about how many times an element appears in the set beyond whether it appears at all.

Attributes

override def toString: String

Returns a meaningful string representation of this set.

Returns a meaningful string representation of this set.

Attributes

Definition Classes
Any
def transform[C](f: B => C): ZSet[A, C]

Transforms the representation of how many times each element appears in the set with the specified function.

Transforms the representation of how many times each element appears in the set with the specified function.

Attributes

def union[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[A1, B1]

Combines this set with the specified set to produce a new set where the number of times each element appears is the maximum of the number of times it appears in this set and the specified set.

Combines this set with the specified set to produce a new set where the number of times each element appears is the maximum of the number of times it appears in this set and the specified set.

Attributes

def zip[B1 >: B, C](that: ZSet[C, B1])(implicit ev: Commutative[subtypeF.Type[B1]]): ZSet[(A, C), B1]

Combines this set with the specified set to produce their cartesian product.

Combines this set with the specified set to produce their cartesian product.

Attributes

def zipWith[B1 >: B, C, D](that: ZSet[C, B1])(f: (A, C) => D)(implicit ev1: Commutative[subtypeF.Type[B1]], ev2: Commutative[subtypeF.Type[B1]]): ZSet[D, B1]

Combines this set with the specified set to produce their cartesian product, combining pair of elements using the specified function f.

Combines this set with the specified set to produce their cartesian product, combining pair of elements using the specified function f.

Attributes

def |[A1 >: A, B1 >: B](that: ZSet[A1, B1])(implicit ev1: Commutative[subtypeF.Type[B1]]): ZSet[A1, B1]

A symbolic alias for union.

A symbolic alias for union.

Attributes