Alias for legacyNullTest
.
Apply the specified PartialFunction
to the specified value
and return
the result in a Full
; if the pf
is not defined at that point return
Empty
.
Apply the specified PartialFunction
to the specified value
and return
the result in a Full
; if the pf
is not defined at that point return
Empty
.
The value to transform.
The partial function to use to transform the value.
A Full
containing the transformed value if
pf.isDefinedAt(value)
and Empty
otherwise.
Apply the specified PartialFunction
to the specified value
and return the result
in a Full
; if the pf
is not defined at that point return
Empty.
Apply the specified PartialFunction
to the specified value
and return the result
in a Full
; if the pf
is not defined at that point return
Empty.
The partial function to use to transform the value.
The value to transform.
A Full
containing the transformed value if
pf.isDefinedAt(value)
and Empty
otherwise.
Transform a List
with zero or more elements to a Box
, losing all but
the first element if there are more than one.
Transform a List
with zero or more elements to a Box
, losing all but
the first element if there are more than one.
Full(x)
with the head of the list if it contains at least one
element and Empty
otherwise.
Create a Box
from the specified Box
, checking for null
.
Create a Box
from the specified Box
, checking for null
.
Full(in)
if in
is a Full
box and its value is non-null,
Empty
otherwise.
Create a Box
from the specified Option
.
Create a Box
from the specified Option
.
Full
with the contents if the Option
is Some
and Empty
otherwise.
Create a Full
box containing the specified value if in
is of type
B
and Empty
otherwise.
Create a Full
box containing the specified value if in
is of type
B
and Empty
otherwise.
For example:
scala> Box.asA[Int]("boom") res0: olon.common.Box[Int] = Empty scala> Box.asA[Int](5) res1: olon.common.Box[Int] = Full(5)
This implicit transformation allows one to use a Box
as an Iterable
of
zero or one elements.
This implicit transformation allows one to use a Box
as an Iterable
of
zero or one elements.
A single-element List
with the contents if the box is Full
and Nil
otherwise.
This implicit transformation allows one to use a Box
as an Option
.
This implicit transformation allows one to use a Box
as an Option
.
Note that Box
implements get
specifically to avoid usage of .get
on
Box
instances. Boxes should be opened using openOrThrowException
and
their contents compared using == Full(expectedValue)
.
Some
with the contents if the box is Full
and None
otherwise.
Create a Full
box containing the specified value if in
is an instance of
the specified class clz
and Empty
otherwise.
Create a Full
box containing the specified value if in
is an instance of
the specified class clz
and Empty
otherwise.
This is basically a Java-friendly version of asA
, which you should
prefer when using Scala.
For example:
scala> Box.isA("boom", classOf[Int]) res0: olon.common.Box[Int] = Empty scala> Box.isA(5, classOf[Int]) res1: olon.common.Box[Int] = Full(5)
This method allows one to encapsulate any object in a Box in a null-safe
manner, converting null
values to Empty
.
This method allows one to encapsulate any object in a Box in a null-safe
manner, converting null
values to Empty
.
Full
if in
is not null and Empty
otherwise.
This implicit transformation allows one to use an Option
as a Box
.
This implicit transformation allows one to use an Option
as a Box
.
Full
with the contents if the Option
is Some
and Empty
otherwise.
(Since version ) see corresponding Javadoc for more information.
(Since version 3.0) Use the correctly-spelled primitiveMap instead.
Implementation for the
Box
singleton.