Class/Object

com.avsystem.commons.misc

Opt

Related Docs: object Opt | package misc

Permalink

final class Opt[+A] extends AnyVal with Serializable

Like Option but implemented as value class (avoids boxing) and treats null as no value. Therefore, there is no equivalent for Some(null).

If you need a value-class version of Option which differentiates between no value and null value, use NOpt.

Linear Supertypes
Serializable, Serializable, AnyVal, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Opt
  2. Serializable
  3. Serializable
  4. AnyVal
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def boxed[B](implicit boxing: Boxing[A, B]): Opt[B]

    Permalink
    Annotations
    @inline()
  6. def boxedOrNull[B >: Null](implicit boxing: Boxing[A, B]): B

    Permalink
    Annotations
    @inline()
  7. def collect[B](pf: PartialFunction[A, B]): Opt[B]

    Permalink
    Annotations
    @inline()
  8. def contains[A1 >: A](elem: A1): Boolean

    Permalink
    Annotations
    @inline()
  9. def exists(p: (A) ⇒ Boolean): Boolean

    Permalink
    Annotations
    @inline()
  10. def filter(p: (A) ⇒ Boolean): Opt[A]

    Permalink
    Annotations
    @inline()
  11. def filterNot(p: (A) ⇒ Boolean): Opt[A]

    Permalink
    Annotations
    @inline()
  12. def flatMap[B](f: (A) ⇒ Opt[B]): Opt[B]

    Permalink
    Annotations
    @inline()
  13. def flatten[B](implicit ev: <:<[A, Opt[B]]): Opt[B]

    Permalink
    Annotations
    @inline()
  14. def fold[B](ifEmpty: ⇒ B)(f: (A) ⇒ B): B

    Permalink
    Annotations
    @inline()
  15. def forEmpty(sideEffect: ⇒ Unit): Opt[A]

    Permalink

    Apply side effect only if Opt is empty.

    Apply side effect only if Opt is empty. It's a bit like foreach for Opt.Empty

    sideEffect

    - code to be executed if opt is empty

    returns

    the same opt

    Annotations
    @inline()
    Example:
    1. captionOpt.forEmpty(logger.warn("caption is empty")).foreach(setCaption)
  16. def forall(p: (A) ⇒ Boolean): Boolean

    Permalink
    Annotations
    @inline()
  17. def foreach[U](f: (A) ⇒ U): Unit

    Permalink
    Annotations
    @inline()
  18. def get: A

    Permalink
    Annotations
    @inline()
  19. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  20. def getOrElse[B >: A](default: ⇒ B): B

    Permalink
    Annotations
    @inline()
  21. def isDefined: Boolean

    Permalink
    Annotations
    @inline()
  22. def isEmpty: Boolean

    Permalink
    Annotations
    @inline()
  23. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  24. def iterator: Iterator[A]

    Permalink
    Annotations
    @inline()
  25. def map[B](f: (A) ⇒ B): Opt[B]

    Permalink
    Annotations
    @inline()
  26. def nonEmpty: Boolean

    Permalink
    Annotations
    @inline()
  27. def orElse[B >: A](alternative: ⇒ Opt[B]): Opt[B]

    Permalink
    Annotations
    @inline()
  28. def orNull[B >: A](implicit ev: <:<[Null, B]): B

    Permalink
    Annotations
    @inline()
  29. def toLeft[X](right: ⇒ X): Either[A, X]

    Permalink
    Annotations
    @inline()
  30. def toList: List[A]

    Permalink
    Annotations
    @inline()
  31. def toNOpt: NOpt[A]

    Permalink
    Annotations
    @inline()
  32. def toOptArg: OptArg[A]

    Permalink
    Annotations
    @inline()
  33. def toOptRef[B >: Null](implicit boxing: Boxing[A, B]): OptRef[B]

    Permalink
    Annotations
    @inline()
  34. def toOption: Option[A]

    Permalink
    Annotations
    @inline()
  35. def toRight[X](left: ⇒ X): Either[X, A]

    Permalink
    Annotations
    @inline()
  36. def toString(): String

    Permalink
    Definition Classes
    Opt → Any
  37. def unboxed[B](implicit unboxing: Unboxing[B, A]): Opt[B]

    Permalink
    Annotations
    @inline()
  38. def withFilter(p: (A) ⇒ Boolean): WithFilter[A]

    Permalink
    Annotations
    @inline()

Inherited from Serializable

Inherited from Serializable

Inherited from AnyVal

Inherited from Any

Ungrouped