sealed abstract class Option[A] extends Iterable[A]
This class represents optional values. Instances of Option
are either instances of case class Some
or it is case
object None
.
- Source
- JavaAPI.scala
Linear Supertypes
Known Subclasses
Type Hierarchy
Ordering
- Alphabetic
- By Inheritance
Inherited
- Option
- Iterable
- AnyRef
- Any
Implicitly
- by java2ScalaOption
- by any2stringadd
- by StringFormat
- by Ensuring
- by ArrowAssoc
- Hide All
- Show All
Visibility
- Public
- Protected
Abstract Value Members
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def +(other: String): String
- def ->[B](y: B): (Option[A], B)
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def canEqual(that: Any): Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Equals
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @HotSpotIntrinsicCandidate() @native()
- final def collect[B](pf: PartialFunction[A, B]): scala.Option[B]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def contains[A1 >: A](elem: A1): Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- def ensuring(cond: (Option[A]) => Boolean, msg: => Any): Option[A]
- def ensuring(cond: (Option[A]) => Boolean): Option[A]
- def ensuring(cond: Boolean, msg: => Any): Option[A]
- def ensuring(cond: Boolean): Option[A]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def exists(p: (A) => Boolean): Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def filter(p: (A) => Boolean): scala.Option[A]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def filterNot(p: (A) => Boolean): scala.Option[A]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def flatMap[B](f: (A) => scala.Option[B]): scala.Option[B]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- def flatten[B](implicit ev: <:<[A, scala.Option[B]]): scala.Option[B]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- final def fold[B](ifEmpty: => B)(f: (A) => B): B
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- def forEach(arg0: Consumer[_ >: A <: AnyRef]): Unit
- Definition Classes
- Iterable
- final def forall(p: (A) => Boolean): Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def foreach[U](f: (A) => U): Unit
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- def isDefined: Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iterator(): Iterator[A]
- Definition Classes
- Option → Iterable
- final def knownSize: Int
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option → IterableOnce
- final def map[B](f: (A) => B): scala.Option[B]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def nonEmpty: Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @HotSpotIntrinsicCandidate() @native()
- final def orElse[B >: A](alternative: => scala.Option[B]): scala.Option[B]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def orNull[A1 >: A](implicit ev: <:<[Null, A1]): A1
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- def productArity: Int
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Product
- def productElement(n: Int): Any
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Product
- def productElementName(n: Int): String
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Product
- def productElementNames: Iterator[String]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Product
- def productIterator: Iterator[Any]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Product
- def productPrefix: String
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Product
- def spliterator(): Spliterator[A]
- Definition Classes
- Iterable
- def stepper[S <: Stepper[_]](implicit shape: StepperShape[A, S]): S
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- IterableOnce
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- final def toLeft[X](right: => X): Either[A, X]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- def toList: List[A]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- final def toRight[X](left: => X): Either[X, A]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def unzip[A1, A2](implicit asPair: <:<[A, (A1, A2)]): (scala.Option[A1], scala.Option[A2])
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- final def unzip3[A1, A2, A3](implicit asTriple: <:<[A, (A1, A2, A3)]): (scala.Option[A1], scala.Option[A2], scala.Option[A3])
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def withFilter(p: (A) => Boolean): WithFilter
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
- Annotations
- @inline()
- final def zip[A1 >: A, B](that: scala.Option[B]): scala.Option[(A1, B)]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Definition Classes
- Option
Shadowed Implicit Value Members
- def get: A
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(option: scala.Option[A]).get
- Definition Classes
- Option
- final def getOrElse[B >: A](default: => B): B
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(option: scala.Option[A]).getOrElse(default)
- Definition Classes
- Option
- Annotations
- @inline()
- final def isDefined: Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(option: scala.Option[A]).isDefined
- Definition Classes
- Option
- final def isEmpty: Boolean
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(option: scala.Option[A]).isEmpty
- Definition Classes
- Option
- def iterator: Iterator[A]
- Implicit
- This member is added by an implicit conversion from Option[A] toscala.Option[A] performed by method java2ScalaOption in org.apache.pekko.japi.Option.
- Shadowing
- This implicitly inherited member is shadowed by one or more members in this class.
To access this member you can use a type ascription:(option: scala.Option[A]).iterator
- Definition Classes
- Option → IterableOnce
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated
(Since version 9)
- def formatted(fmtstr: String): String
- Implicit
- This member is added by an implicit conversion from Option[A] toStringFormat[Option[A]] performed by method StringFormat in scala.Predef.
- Definition Classes
- StringFormat
- Annotations
- @deprecated @inline()
- Deprecated
(Since version 2.12.16) Use
formatString.format(value)
instead ofvalue.formatted(formatString)
, or use thef""
string interpolator. In Java 15 and later,formatted
resolves to the new method in String which has reversed parameters.
- def →[B](y: B): (Option[A], B)
- Implicit
- This member is added by an implicit conversion from Option[A] toArrowAssoc[Option[A]] performed by method ArrowAssoc in scala.Predef.
- Definition Classes
- ArrowAssoc
- Annotations
- @deprecated
- Deprecated
(Since version 2.13.0) Use
->
instead. If you still wish to display it as one character, consider using a font with programming ligatures such as Fira Code.