-
-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Compare it with the wrapping via normal case class:
import monix.newtypes.{NewsubtypeWrapped, NewtypeWrapped}
import java.util.concurrent.atomic.AtomicReference
object NewTypeNull extends App {
case class W1(value: String)
type W2 = W2.Type
object W2 extends NewtypeWrapped[String]
type W3 = W3.Type
object W3 extends NewsubtypeWrapped[String]
val a1 = new AtomicReference[W1]()
val a2 = new AtomicReference[W2]()
val a3 = new AtomicReference[W3]()
println(s"[a1.get(): ${a1.get()}], [a1.get() == null: ${a1.get() == null}], [a1.get() eq null: ${a1.get() eq null}]")
println(s"[a2.get(): ${a2.get()}], [a2.get() == null: ${a2.get() == null}], [a2.get() eq null: ${a2.get() eq null}]")
println(s"[a3.get(): ${a3.get()}], [a3.get() == null: ${a3.get() == null}], [a3.get() eq null: ${a3.get() eq null}]")
}prints
[a1.get(): null], [a1.get() == null: true], [a1.get() eq null: true]
[a2.get(): null], [a2.get() == null: true], [a2.get() eq null: false]
[a3.get(): null], [a3.get() == null: true], [a3.get() eq null: true]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels