scala

Some

class Some[+A](x: A) extends Option[A] with Product

Class Some[A] represents existing values of type A .

attributes: final
go to: companion
source: Option.scala
    version
  1. 1 . 0, 16/07/2003

    authors:
  1. Martin Odersky

Inherited
  1. Hide All
  2. Show all
  1. Option
  2. Product
  3. Equals
  4. AnyRef
  5. Any
Visibility
  1. Public
  2. All

Instance constructors

  1. new Some(x: A)

Type Members

  1. class WithFilter extends AnyRef

    We need a whole WithFilter class to honor the "doesn't create a new collection" contract even though it seems unlikely to matter much in a collection with max size 1 .

Value Members

  1. def !=(arg0: AnyRef): Boolean

  2. def !=(arg0: Any): Boolean

    o != arg0 is the same as !(o == (arg0)).

  3. def ##(): Int

  4. def $asInstanceOf[T0](): T0

  5. def $isInstanceOf[T0](): Boolean

  6. def ==(arg0: AnyRef): Boolean

    o == arg0 is the same as if (o eq null) arg0 eq null else o.equals(arg0).

  7. def ==(arg0: Any): Boolean

    o == arg0 is the same as o.equals(arg0).

  8. def asInstanceOf[T0]: T0

    This method is used to cast the receiver object to be of type T0.

  9. def canEqual(arg0: Any): Boolean

    A method that should be called from every well-designed equals method that is open to be overridden in a subclass .

  10. def clone(): AnyRef

    This method creates and returns a copy of the receiver object .

  11. def collect[B](pf: PartialFunction[A, B]): Option[B]

    If the given partial function pf is defined for the option's value, apply it to the value .

  12. def eq(arg0: AnyRef): Boolean

    This method is used to test whether the argument (arg0) is a reference to the receiver object (this).

  13. def equals(arg0: Any): Boolean

    The equality method defined in AnyRef.

  14. def exists(p: (A) ⇒ Boolean): Boolean

    If the option is nonempty, p(value), otherwise false .

  15. def filter(p: (A) ⇒ Boolean): Option[A]

    If the option is nonempty and the given predicate p yields false on its value, return None .

  16. def finalize(): Unit

    This method is called by the garbage collector on the receiver object when garbage collection determines that there are no more references to the object .

  17. def flatMap[B](f: (A) ⇒ Option[B]): Option[B]

    If the option is nonempty, return a function applied to its value .

  18. def foreach[U](f: (A) ⇒ U): Unit

    Apply the given procedure f to the option's value, if it is nonempty .

  19. def get: A

    get the value of this option .

  20. def getClass(): java.lang.Class[_ <: java.lang.Object]

    Returns a representation that corresponds to the dynamic class of the receiver object .

  21. def getOrElse[B >: A](default: ⇒ B): B

    If the option is nonempty return its value, otherwise return the result of evaluating a default expression .

  22. def hashCode(): Int

    Returns a hash code value for the object .

  23. def isDefined: Boolean

    True if the option is a Some( .

  24. def isEmpty: Boolean

    True if the option is the None value, false otherwise .

  25. def isInstanceOf[T0]: Boolean

    This method is used to test whether the dynamic type of the receiver object is T0.

  26. def iterator: Iterator[A]

    An singleton iterator returning the option's value if it is nonempty or the empty iterator if the option is empty .

  27. def map[B](f: (A) ⇒ B): Option[B]

    If the option is nonempty, return a function applied to its value, wrapped in a Some i .

  28. def ne(arg0: AnyRef): Boolean

    o.ne(arg0) is the same as !(o.eq(arg0)).

  29. def notify(): Unit

    Wakes up a single thread that is waiting on the receiver object's monitor .

  30. def notifyAll(): Unit

    Wakes up all threads that are waiting on the receiver object's monitor .

  31. def orElse[B >: A](alternative: ⇒ Option[B]): Option[B]

    If the option is nonempty return it, otherwise return the result of evaluating an alternative expression .

  32. def orNull[A1 >: A](implicit ev: <:<[Null, A1]): A1

    The option's value if it is nonempty, or null if it is empty .

  33. def productArity: Int

    return k for a product A(x_1, .

  34. def productElement(arg0: Int): Any

    For a product A(x_1, .

  35. def productElementName(n: Int): String

    Returns the name of the field at the given index from the definition of the class .

  36. def productElements: Iterator[Any]

  37. def productIterator: Iterator[Any]

    An iterator that returns all fields of this product

  38. def productPrefix: String

    By default the empty string .

  39. def synchronized[T0](arg0: T0): T0

  40. def toLeft[X](right: ⇒ X): Product with Either[A, X]

    An Either that is a Right with the given argument right if this is empty, or a Left if this is nonempty with the option's value .

  41. def toList: List[A]

    A singleton list containing the option's value if it is nonempty or the empty list if the option is empty .

  42. def toRight[X](left: ⇒ X): Product with Either[X, A]

    An Either that is a Left with the given argument left if this is empty, or a Right if this is nonempty with the option's value .

  43. def toString(): String

    Returns a string representation of the object .

  44. def wait(): Unit

  45. def wait(arg0: Long, arg1: Int): Unit

  46. def wait(arg0: Long): Unit

  47. def withFilter(p: (A) ⇒ Boolean): WithFilter

    Necessary to keep Option from being implicitly converted to Iterable in for comprehensions .

  48. val x: A