In Java the AtomicReference class has a "compareAndSet(V expect, V update)" method. Sometimes I wish Scala's "asInstanceOf" had an "expected" type parameter too, to be a bit more type-safe when casting.
-
-
Not quite. Because we're trying to ascertain that the value with inferred type A is of the expected type Expect, before casting it to T, for which we have no type information. But I'd forgotten about that apply!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.