WeakHashSet

final class WeakHashSet[A <: AnyRef](initialCapacity: Int, loadFactor: Double) extends Set[A]

A HashSet where the elements are stored weakly. Elements in this set are eligible for GC if no other hard references are associated with them. Its primary use case is as a canonical reference identity holder (aka "hash-consing") via findEntryOrUpdate

This Set implementation cannot hold null. Any attempt to put a null in it will result in a NullPointerException

This set implementation is not in general thread safe without external concurrency control. However it behaves properly when GC concurrently collects elements in this set.

Companion
object
trait Set[A]
trait SetOps[A, [A] =>> Set[A], Set[A]]
trait Shrinkable[A]
trait Builder[A, Set[A]]
trait Growable[A]
trait Clearable
trait Cloneable[Set[A]]
trait Cloneable
trait Set[A]
trait Equals
trait SetOps[A, [A] =>> Set[A], Set[A]]
trait A => Boolean
trait Iterable[A]
trait Iterable[A]
trait IterableFactoryDefaults[A, [A] =>> Set[A]]
trait IterableOps[A, [A] =>> Set[A], Set[A]]
trait IterableOnceOps[A, [A] =>> Set[A], Set[A]]
class Object
trait Matchable
class Any

Type members

Types

type This = WeakHashSet[A]

Value members

Constructors

def this()

Concrete methods

override def addOne(elem: A): WeakHashSet[A]
Definition Classes
override def clear(): Unit
Definition Classes
def contains(elem: A): Boolean
override def empty: This
def findEntry(elem: A): A
def findEntryOrUpdate(elem: A): A
override def foreach[U](f: A => U): Unit
Definition Classes
def get(elem: A): Option[A]
override def isEmpty: Boolean
Definition Classes
override def iterator: Iterator[A]
Definition Classes
override def size: Int
Definition Classes
override def subtractOne(elem: A): WeakHashSet[A]
Definition Classes
override def toList(): List[A]
Definition Classes

Inherited methods

final def &(that: Set[A]): Set[A]
Inherited from
SetOps
final def &~(that: Set[A]): Set[A]
Inherited from
SetOps
final def ++[B >: A](suffix: IterableOnce[B]): Set[B]
Inherited from
IterableOps
final def ++(that: IterableOnce[A]): Set[A]
Inherited from
SetOps
final def ++=(xs: IterableOnce[A]): WeakHashSet[A]
Inherited from
Growable
final def +=(elem: A): WeakHashSet[A]
Inherited from
Growable
final def --=(xs: IterableOnce[A]): WeakHashSet[A]
Inherited from
Shrinkable
final def -=(elem: A): WeakHashSet[A]
Inherited from
Shrinkable
def add(elem: A): Boolean
Inherited from
SetOps
Inherited from
Growable
Inherited from
IterableOnceOps
def andThen[A](g: Boolean => A): A => A
Inherited from
Function1
final def apply(elem: A): Boolean
Inherited from
SetOps
def canEqual(that: Any): Boolean
Inherited from
Set
override def clone(): Set[A]
Definition Classes
Inherited from
SetOps
def collect[B](pf: PartialFunction[A, B]): Set[B]
Inherited from
IterableOps
def collectFirst[B](pf: PartialFunction[A, B]): Option[B]
Inherited from
IterableOnceOps
def compose[A](g: A => A): A => Boolean
Inherited from
Function1
def concat[B >: A](suffix: IterableOnce[B]): Set[B]
Inherited from
IterableOps
def concat(that: IterableOnce[A]): Set[A]
Inherited from
SetOps
def copyToArray[B >: A](xs: Array[B], start: Int, len: Int): Int
Inherited from
IterableOnceOps
@deprecatedOverriding("This should always forward to the 3-arg version of this method", "2.13.4")
def copyToArray[B >: A](xs: Array[B], start: Int): Int
Inherited from
IterableOnceOps
@deprecatedOverriding("This should always forward to the 3-arg version of this method", "2.13.4")
def copyToArray[B >: A](xs: Array[B]): Int
Inherited from
IterableOnceOps
def corresponds[B](that: IterableOnce[B])(p: (A, B) => Boolean): Boolean
Inherited from
IterableOnceOps
def count(p: A => Boolean): Int
Inherited from
IterableOnceOps
def diff(that: Set[A]): Set[A]
Inherited from
SetOps
def drop(n: Int): Set[A]
Inherited from
IterableOps
def dropRight(n: Int): Set[A]
Inherited from
IterableOps
def dropWhile(p: A => Boolean): Set[A]
Inherited from
IterableOps
override def equals(that: Any): Boolean
Definition Classes
Set -> Equals -> Any
Inherited from
Set
def exists(p: A => Boolean): Boolean
Inherited from
IterableOnceOps
def filter(pred: A => Boolean): Set[A]
Inherited from
IterableOps
Inherited from
SetOps
def filterNot(pred: A => Boolean): Set[A]
Inherited from
IterableOps
def find(p: A => Boolean): Option[A]
Inherited from
IterableOnceOps
def flatMap[B](f: A => IterableOnce[B]): Set[B]
Inherited from
IterableOps
def flatten[B](implicit asIterable: A => IterableOnce[B]): Set[B]
Inherited from
IterableOps
def fold[A1 >: A](z: A1)(op: (A1, A1) => A1): A1
Inherited from
IterableOnceOps
def foldLeft[B](z: B)(op: (B, A) => B): B
Inherited from
IterableOnceOps
def foldRight[B](z: B)(op: (A, B) => B): B
Inherited from
IterableOnceOps
def forall(p: A => Boolean): Boolean
Inherited from
IterableOnceOps
protected def fromSpecific(coll: IterableOnce[A]): Set[A]
def groupBy[K](f: A => K): Map[K, Set[A]]
Inherited from
IterableOps
def groupMap[K, B](key: A => K)(f: A => B): Map[K, Set[B]]
Inherited from
IterableOps
def groupMapReduce[K, B](key: A => K)(f: A => B)(reduce: (B, B) => B): Map[K, B]
Inherited from
IterableOps
def grouped(size: Int): Iterator[Set[A]]
Inherited from
IterableOps
override def hashCode(): Int
Definition Classes
Set -> Any
Inherited from
Set
def head: A
Inherited from
IterableOps
Inherited from
IterableOps
def init: Set[A]
Inherited from
IterableOps
Inherited from
IterableOps
def intersect(that: Set[A]): Set[A]
Inherited from
SetOps
Definition Classes
Inherited from
IterableOps
override def iterableFactory: IterableFactory[[A] =>> Set[A]]
Definition Classes
Inherited from
Set
override def knownSize: Int
Definition Classes
Inherited from
SetOps
def last: A
Inherited from
IterableOps
Inherited from
IterableOps
def lazyZip[B](that: Iterable[B]): LazyZip2[A, B, WeakHashSet[A]]
Inherited from
Iterable
def map[B](f: A => B): Set[B]
Inherited from
IterableOps
def mapResult[NewTo](f: Set[A] => NewTo): Builder[A, NewTo]
Inherited from
Builder
def max[B >: A](implicit ord: Ordering[B]): A
Inherited from
IterableOnceOps
def maxBy[B](f: A => B)(implicit cmp: Ordering[B]): A
Inherited from
IterableOnceOps
def maxByOption[B](f: A => B)(implicit cmp: Ordering[B]): Option[A]
Inherited from
IterableOnceOps
def maxOption[B >: A](implicit ord: Ordering[B]): Option[A]
Inherited from
IterableOnceOps
def min[B >: A](implicit ord: Ordering[B]): A
Inherited from
IterableOnceOps
def minBy[B](f: A => B)(implicit cmp: Ordering[B]): A
Inherited from
IterableOnceOps
def minByOption[B](f: A => B)(implicit cmp: Ordering[B]): Option[A]
Inherited from
IterableOnceOps
def minOption[B >: A](implicit ord: Ordering[B]): Option[A]
Inherited from
IterableOnceOps
final def mkString: String
Inherited from
IterableOnceOps
final def mkString(sep: String): String
Inherited from
IterableOnceOps
final def mkString(start: String, sep: String, end: String): String
Inherited from
IterableOnceOps
protected def newSpecificBuilder: Builder[A, Set[A]]
@deprecatedOverriding("nonEmpty is defined as !isEmpty; override isEmpty instead", "2.13.0")
Inherited from
IterableOnceOps
def partition(p: A => Boolean): (Set[A], Set[A])
Inherited from
IterableOps
def partitionMap[A1, A2](f: A => Either[A1, A2]): (Set[A1], Set[A2])
Inherited from
IterableOps
def product[B >: A](implicit num: Numeric[B]): B
Inherited from
IterableOnceOps
def reduce[B >: A](op: (B, B) => B): B
Inherited from
IterableOnceOps
def reduceLeft[B >: A](op: (B, A) => B): B
Inherited from
IterableOnceOps
def reduceLeftOption[B >: A](op: (B, A) => B): Option[B]
Inherited from
IterableOnceOps
def reduceOption[B >: A](op: (B, B) => B): Option[B]
Inherited from
IterableOnceOps
def reduceRight[B >: A](op: (A, B) => B): B
Inherited from
IterableOnceOps
def reduceRightOption[B >: A](op: (A, B) => B): Option[B]
Inherited from
IterableOnceOps
def remove(elem: A): Boolean
Inherited from
SetOps
def result(): Set[A]
Inherited from
SetOps
protected def reversed: Iterable[A]
Inherited from
IterableOnceOps
def scan[B >: A](z: B)(op: (B, B) => B): Set[B]
Inherited from
IterableOps
def scanLeft[B](z: B)(op: (B, A) => B): Set[B]
Inherited from
IterableOps
def scanRight[B](z: B)(op: (A, B) => B): Set[B]
Inherited from
IterableOps
def sizeCompare(that: Iterable[_]): Int
Inherited from
IterableOps
def sizeCompare(otherSize: Int): Int
Inherited from
IterableOps
final def sizeHint(coll: IterableOnce[_], delta: Int): Unit
Inherited from
Builder
def sizeHint(size: Int): Unit
Inherited from
Builder
final def sizeHintBounded(size: Int, boundingColl: Iterable[_]): Unit
Inherited from
Builder
Inherited from
IterableOps
def slice(from: Int, until: Int): Set[A]
Inherited from
IterableOps
def sliding(size: Int, step: Int): Iterator[Set[A]]
Inherited from
IterableOps
def sliding(size: Int): Iterator[Set[A]]
Inherited from
IterableOps
def span(p: A => Boolean): (Set[A], Set[A])
Inherited from
IterableOps
override def splitAt(n: Int): (Set[A], Set[A])
Definition Classes
Inherited from
IterableOps
def stepper[S <: Stepper[_]](implicit shape: StepperShape[A, S]): S
Inherited from
IterableOnce
def subsetOf(that: Set[A]): Boolean
Inherited from
SetOps
def subsets(): Iterator[Set[A]]
Inherited from
SetOps
def subsets(len: Int): Iterator[Set[A]]
Inherited from
SetOps
Inherited from
Shrinkable
def sum[B >: A](implicit num: Numeric[B]): B
Inherited from
IterableOnceOps
def tail: Set[A]
Inherited from
IterableOps
Inherited from
IterableOps
def take(n: Int): Set[A]
Inherited from
IterableOps
def takeRight(n: Int): Set[A]
Inherited from
IterableOps
def takeWhile(p: A => Boolean): Set[A]
Inherited from
IterableOps
override def tapEach[U](f: A => U): Set[A]
Definition Classes
Inherited from
IterableOps
def to[C1](factory: Factory[A, C1]): C1
Inherited from
IterableOnceOps
def toArray[B >: A](implicit ClassTag[B]): Array[B]
Inherited from
IterableOnceOps
final def toBuffer[B >: A]: Buffer[B]
Inherited from
IterableOnceOps
Inherited from
Iterable
def toMap[K, V](implicit ev: A <:< (K, V)): Map[K, V]
Inherited from
IterableOnceOps
def toSeq: Seq[A]
Inherited from
IterableOnceOps
def toSet[B >: A]: Set[B]
Inherited from
IterableOnceOps
override def toString(): String
Definition Classes
Set -> Function1 -> Iterable -> Any
Inherited from
Set
Inherited from
IterableOnceOps
def transpose[B](implicit asIterable: A => Iterable[B]): Set[Set[B]]
Inherited from
IterableOps
final def union(that: Set[A]): Set[A]
Inherited from
SetOps
def unzip[A1, A2](implicit asPair: A => (A1, A2)): (Set[A1], Set[A2])
Inherited from
IterableOps
def unzip3[A1, A2, A3](implicit asTriple: A => (A1, A2, A3)): (Set[A1], Set[A2], Set[A3])
Inherited from
IterableOps
def update(elem: A, included: Boolean): Unit
Inherited from
SetOps
def view: View[A]
Inherited from
IterableOps
def withFilter(p: A => Boolean): WithFilter[A, [A] =>> Set[A]]
Inherited from
IterableOps
def zip[B](that: IterableOnce[B]): Set[(A, B)]
Inherited from
IterableOps
def zipAll[A1 >: A, B](that: Iterable[B], thisElem: A1, thatElem: B): Set[(A1, B)]
Inherited from
IterableOps
def zipWithIndex: Set[(A, Int)]
Inherited from
IterableOps
final def |(that: Set[A]): Set[A]
Inherited from
SetOps

Deprecated and Inherited methods

@deprecated("Use ++ with an explicit collection argument instead of + with varargs", "2.13.0")
def +(elem1: A, elem2: A, elems: A*): Set[A]
Deprecated
Inherited from
SetOps
@deprecated("Consider requiring an immutable Set or fall back to Set.union", "2.13.0")
def +(elem: A): Set[A]
Deprecated
Inherited from
SetOps
@deprecated("Use ++ instead of ++: for collections of type Iterable", "2.13.0")
def ++:[B >: A](that: IterableOnce[B]): Set[B]
Deprecated
Inherited from
IterableOps
@inline @deprecated("Use `++=` aka `addAll` instead of varargs `+=`; infix operations with an operand of multiple args will be deprecated", "2.13.0")
final def +=(elem1: A, elem2: A, elems: A*): WeakHashSet[A]
Deprecated
Inherited from
Growable
@deprecated("Use &- with an explicit collection argument instead of - with varargs", "2.13.0")
def -(elem1: A, elem2: A, elems: A*): Set[A]
Deprecated
Inherited from
SetOps
@deprecated("Consider requiring an immutable Set or fall back to Set.diff", "2.13.0")
def -(elem: A): Set[A]
Deprecated
Inherited from
SetOps
@deprecated("Consider requiring an immutable Set", "2.13.0")
def --(that: IterableOnce[A]): Set[A]
Deprecated
Inherited from
SetOps
@deprecated("Use `--=` aka `subtractAll` instead of varargs `-=`; infix operations with an operand of multiple args will be deprecated", "2.13.3")
def -=(elem1: A, elem2: A, elems: A*): WeakHashSet[A]
Deprecated
Inherited from
Shrinkable
@inline @deprecated("Use foldLeft instead of /:", "2.13.0")
final def /:[B](z: B)(op: (B, A) => B): B
Deprecated
Inherited from
IterableOnceOps
@inline @deprecated("Use foldRight instead of :\\", "2.13.0")
final def :\[B](z: B)(op: (A, B) => B): B
Deprecated
Inherited from
IterableOnceOps
@deprecated("`aggregate` is not relevant for sequential collections. Use `foldLeft(z)(seqop)` instead.", "2.13.0")
def aggregate[B](z: => B)(seqop: (B, A) => B, combop: (B, B) => B): B
Deprecated
Inherited from
IterableOnceOps
@inline @deprecatedOverriding("Use iterableFactory instead", "2.13.0") @deprecated("Use iterableFactory instead", "2.13.0")
def companion: IterableFactory[[A] =>> Set[A]]
Deprecated
Inherited from
IterableOps
@inline @deprecated("Use `dest ++= coll` instead", "2.13.0")
final def copyToBuffer[B >: A](dest: Buffer[B]): Unit
Deprecated
Inherited from
IterableOnceOps
@deprecated("Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details)", "2.13.0")
Deprecated
Inherited from
IterableOnceOps
@deprecated("Use coll instead of repr in a collection implementation, use the collection value itself from the outside", "2.13.0")
final def repr: Set[A]
Deprecated
Inherited from
IterableOps
@inline @deprecated("Use filterInPlace instead", "2.13.0")
final def retain(p: A => Boolean): Unit
Deprecated
Inherited from
SetOps
@deprecated("Iterable.seq always returns the iterable itself", "2.13.0")
Deprecated
Inherited from
Iterable
@inline @deprecated("Use .iterator instead of .toIterator", "2.13.0")
final def toIterator: Iterator[A]
Deprecated
Inherited from
IterableOnceOps
@inline @deprecated("Use .to(LazyList) instead of .toStream", "2.13.0")
final def toStream: Stream[A]
Deprecated
Inherited from
IterableOnceOps
@deprecated("Use toIterable instead", "2.13.0")
Deprecated
Inherited from
IterableOps
@deprecated("Use .view.slice(from, until) instead of .view(from, until)", "2.13.0")
def view(from: Int, until: Int): View[A]
Deprecated
Inherited from
IterableOps