WeakReference

scala.ref.WeakReference
See theWeakReference companion class
object WeakReference

An extractor for weak reference values.

Attributes

Companion
class
Source
WeakReference.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def apply[T <: AnyRef](value: T): WeakReference[T]

Creates a weak reference pointing to value.

Creates a weak reference pointing to value.

Type parameters

T

the type of the value to wrap in a weak reference

Value parameters

value

the object to be weakly referenced

Attributes

Returns

a new WeakReference wrapping value

Source
WeakReference.scala
def unapply[T <: AnyRef](wr: WeakReference[T]): Option[T]

Optionally returns the referenced value, or None if that value no longer exists.

Optionally returns the referenced value, or None if that value no longer exists.

Type parameters

T

the type of the value to extract from the weak reference

Value parameters

wr

the weak reference to extract a value from

Attributes

Returns

Some(value) if the referent is still reachable, or None if it has been garbage collected

Source
WeakReference.scala