blob: fed8a6165699836f0a0847944004dc3d3babf713 (
plain) (
blame)
1
2
3
4
5
6
7
|
object Test {
import scala.ref.WeakReference
def unapply[T <: AnyRef](wr: WeakReference[T]): Option[T] = {
val x = wr.underlying.get
if (x != null) Some(x) else None
}
}
|