RichOptional

scala.jdk.OptionConverters.RichOptional
final implicit class RichOptional[A](o: Optional[A]) extends AnyVal

Provides conversions from Java Optional to Scala Option and specialized Optional types.

Type parameters

A

the type of the value contained in the Optional

Value parameters

o

the Java Optional to convert

Attributes

Source
OptionConverters.scala
Graph
Supertypes
class AnyVal
trait Matchable
class Any

Members list

Value members

Concrete methods

def toJavaPrimitive[O](implicit shape: OptionShape[A, O]): O

Converts a generic Java Optional to a specialized variant.

Converts a generic Java Optional to a specialized variant.

Type parameters

O

the target specialized Java Optional type, inferred from the available OptionShape instance (e.g., OptionalInt, OptionalDouble, OptionalLong)

Value parameters

shape

implicit evidence that defines how to convert between Optional[A] and the specialized type O

Attributes

Source
OptionConverters.scala
def toScala: Option[A]

Converts a Java Optional to a Scala Option.

Converts a Java Optional to a Scala Option.

Attributes

Source
OptionConverters.scala

Deprecated methods

def asScala: Option[A]

Converts a Java Optional to a Scala Option.

Converts a Java Optional to a Scala Option.

Attributes

Deprecated
[Since version 2.13.0] Use `toScala` instead
Source
OptionConverters.scala