Class/Object

dogs

List

Related Docs: object List | package dogs

Permalink

sealed abstract class List[A] extends AnyRef

Immutable, singly-linked list implementation.

This code is very similar to scala.List, with a few key differences:

1. It does not expose any "unsafe" methods. 2. It is invariant, whereas scala.List is covariant. 3. It uses subtyping to differentiate non-emptiness.

The types defined here are as follows:

(Every List[A] is either a Nel[A] or an El[A].)

While it does not provide every single Scala collection method, it provides a decent number of them.

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. List
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def isEmpty: Boolean

    Permalink

Concrete Value Members

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  3. def ++(as: List[A]): List[A]

    Permalink

    Append a list to this list.

    Append a list to this list. O(n) on the size of this list

  4. final def ::(a: A): Nel[A]

    Permalink

    Prepend the given value to this List O(1)

  5. def :::(as: List[A]): List[A]

    Permalink

    Append a list to this list.

    Append a list to this list. O(n) on the size of this list

  6. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. def coflatMap[B](f: (List[A]) ⇒ B): List[B]

    Permalink

    Apply a function extracting a B from every sublist, accumuating all the Bs into a List O(n)

  10. final def contains(a: A)(implicit ev: Eq[A]): Boolean

    Permalink

    Returns true if the given value is present in the List.

    Returns true if the given value is present in the List. O(n)

  11. final def drop(num: Int): List[A]

    Permalink

    Returns a List containing the first n elements of this List, if n * < the length of this list, the result will be a copy of this list.

    Returns a List containing the first n elements of this List, if n * < the length of this list, the result will be a copy of this list. O(num)

    Annotations
    @tailrec()
  12. final def dropWhile(pred: (A) ⇒ Boolean): List[A]

    Permalink

    Returns the list with the longest prefix of As matching the given predicate removed.

    Returns the list with the longest prefix of As matching the given predicate removed.

    Annotations
    @tailrec()
  13. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  15. final def exists(pred: (A) ⇒ Boolean): Boolean

    Permalink

    Returns true of any element in the List matches the given predicate.

    Returns true of any element in the List matches the given predicate. O(n)

  16. final def filter(pred: (A) ⇒ Boolean): List[A]

    Permalink

    Construct a new List containing only elements of this List which pass the given predicate O(n)

  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. final def find(pred: (A) ⇒ Boolean): Option[A]

    Permalink

    Return the first element in the List matching the given predicate, if one is found at all.

    Return the first element in the List matching the given predicate, if one is found at all. O(n)

    Annotations
    @tailrec()
  19. final def flatMap[B](f: (A) ⇒ List[B]): List[B]

    Permalink

    Apply a function returning a List to each element of this List, return a List which is the concatenation of all the resulting Lists.

    Apply a function returning a List to each element of this List, return a List which is the concatenation of all the resulting Lists. O(n)

  20. final def foldLeft[B](b: B)(f: (B, A) ⇒ B): B

    Permalink

    A left-associated fold of the List, which accumuates a B value by passing each element of the List to the given accumulating function.

    A left-associated fold of the List, which accumuates a B value by passing each element of the List to the given accumulating function. O(n)

    Annotations
    @tailrec()
  21. final def foldRight[B](b: Eval[B])(f: (A, Eval[B]) ⇒ Eval[B]): Eval[B]

    Permalink

    A right-associative fold on the list which evaluates the tail of the list lazily, allowing this computation to terminate before evailuating all of the elements on the list O(n)

  22. final def forall(p: (A) ⇒ Boolean): Boolean

    Permalink

    Returns true of all elements in the List match the given predicate.

    Returns true of all elements in the List match the given predicate. O(n)

  23. def foreach(f: (A) ⇒ Unit): Unit

    Permalink

    Execute the side-effecting function on each memeber of the list, in order

  24. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  25. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  26. final def headOption: Option[A]

    Permalink

    Return the head of the list, if one exists

  27. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  28. def map[B](f: (A) ⇒ B): List[B]

    Permalink

    Apply a function to each element of this list, producing a new list with the results.

    Apply a function to each element of this list, producing a new list with the results. O(n)

  29. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  30. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  31. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  32. def reverse: List[A]

    Permalink

    Return a List which contains all of the same elements as this List, but in the opposite order O(n)

  33. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  34. final def tailOption: Option[List[A]]

    Permalink

    Return the tail of the list, if one exists

  35. final def tails: Streaming[List[A]]

    Permalink

    Returns a stream of Lists.

    Returns a stream of Lists. the first list is this, and the rest of the stream are the lists generated by subsequently calilng tailOption as long as the list is non-empty.

  36. def take(num: Int): List[A]

    Permalink

    Returns a List containing the first n elements of this List, if n < the length of this list, the result will be a copy of this list.

    Returns a List containing the first n elements of this List, if n < the length of this list, the result will be a copy of this list. O(num)

  37. final def takeWhile(pred: (A) ⇒ Boolean): List[A]

    Permalink

    Returns the longest prefix of elements which match the given predicate.

  38. final def toNel: Option[Nel[A]]

    Permalink
  39. def toScalaList: scala.List[A]

    Permalink
  40. def toString(): String

    Permalink
    Definition Classes
    List → AnyRef → Any
  41. final def unzip[B, C](implicit unz: =:=[(B, C), A]): (List[B], List[C])

    Permalink

    If there is proof that this is a list of (B,C) return a tuple of the lists with the elements separated

  42. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  43. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  44. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  45. final def zip[B](bs: List[B]): List[(A, B)]

    Permalink

    Returns a list of (A,B) pairs.

    Returns a list of (A,B) pairs. If one list is longer than the other, the reminaing elements are ignored

  46. final def zipWithIndex: List[(A, Int)]

    Permalink

    Returns a list of (A,Int) where each A is paired with its zero-based index in the list

Inherited from AnyRef

Inherited from Any

Ungrouped