Geo Geo - 6 months ago 27
Scala Question

Why Some(null) isn't considered None?

I am curious:

scala> Some(null) == None
res10: Boolean = false

Why isn't
transformed to

Answer Source

You should use Option(null) to reach the desired effect and return None.

Some(null) just creates a new Option with a defined value (hence Some) which is actually null, and there are few valid reasons to ever create one like this in real code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download