class WeakConcurrentBag[A] extends AnyRef

A WeakConcurrentBag stores a collection of values, each wrapped in a WeakReference. The structure is optimized for addition, and will achieve zero allocations in the happy path (aside from the allocation of the WeakReference, which is unavoidable). To remove a value from the bag, it is sufficient to clear the corresponding weak reference, at which point the weak reference will be removed from the bag during the next garbage collection.

Garbage collection happens regularly during the add operation. Assuming uniform distribution of hash codes of values added to the bag, the chance of garbage collection occurring during an add operation is 1/n, where n is the capacity of the table backing the bag.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. WeakConcurrentBag
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new WeakConcurrentBag(tableSize: Int)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def add(value: A): WeakReference[A]

    Adds the specified value to the concurrent bag, returning a WeakReference that wraps the value.

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def gc(): Unit

    Performs garbage collection, removing any empty weak references.

  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def iterator: Iterator[A]

    Returns a weakly consistent iterator over the bag.

    Returns a weakly consistent iterator over the bag. This iterator will never throw exceptions even in the presence of concurrent modifications.

  15. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  16. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  18. final def size: Int

    Returns the size of the bag.

    Returns the size of the bag. Due to concurrent modification, this is only an estimate. Note this operation is O(n.max(m)), where n is the number of elements in the collection, and m is the table size.

  19. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  20. final def toString(): String
    Definition Classes
    WeakConcurrentBag → AnyRef → Any
  21. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  23. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Inherited from AnyRef

Inherited from Any

Ungrouped