Optional

zio.prelude.data.Optional
See theOptional companion object
sealed trait Optional[+A]

Custom option type to be used for wrapping external data models where most of the fields are defined to be optional.

Instances of Optional are either Optional.Present or Optional.Absent.

The only difference between this type and scala.Option is that there is an implicit conversion defined from A`` toOptional[A], and fromOption[A]`` to Optional[A].

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Absent
class Present[A]
Self type

Members list

Type members

Classlikes

class WithFilter(p: A => Boolean)

Attributes

Supertypes
class Object
trait Matchable
class Any

Value members

Concrete methods

final def collect[B](pf: PartialFunction[A, B]): Optional[B]
final def contains[A1 >: A](elem: A1): Boolean
final def exists(p: A => Boolean): Boolean
final def filter(p: A => Boolean): Optional[A]
final def filterNot(p: A => Boolean): Optional[A]
final def flatMap[B](f: A => Optional[B]): Optional[B]
final def flatten[B](implicit ev: A <:< Option[B]): Option[B]
final def fold[B](ifEmpty: => B)(f: A => B): B
final def forall(p: A => Boolean): Boolean
final def foreach[U](f: A => U): Unit
final def getOrElse[A0 >: A](default: => A0): A0
final def iterator: Iterator[A]
final def map[B](f: A => B): Optional[B]
final def orElse[B >: A](other: Optional[B]): Optional[B]
final def toChunk: Chunk[A]
final def toLeft[R](right: R): Either[A, R]
final def toList: List[A]
final def toOption: Option[A]

Converts this optional value to standard scala.Option

Converts this optional value to standard scala.Option

Attributes

final def toRight[L](left: L): Either[L, A]
final def toVector: Vector[A]
final def withFilter(p: A => Boolean): WithFilter

Abstract fields