scala.collection.immutable

List

object List extends SeqFactory[List[A][A]]

$factoryInfo

Go to: companion

Inherits

  1. SeqFactory
  2. TraversableFactory
  3. GenericCompanion
  4. AnyRef
  5. Any

Type Members

  1. type Coll = CC[_]

    The underlying collection type with unknown element type

    The underlying collection type with unknown element type

    definition classes: GenericCompanion
    Go to: companion
  2. class GenericCanBuildFrom[A] extends CanBuildFrom[CC[_], A, CC[A]]

    A generic implementation of the CanBuildFrom trait, which forwards all calls to apply(from) to the genericBuilder methof of collection from, and which forwards all calls of apply() to the newBuilder method of this factory

Value Members

  1. def apply[A](xs: A*): List[A]

    Creates a collection with the specified elements

    Creates a collection with the specified elements.

    definition classes: ListGenericCompanion
    Go to: companion
  2. def canBuildFrom[A]: CanBuildFrom[List[_], A, List[A]]

    The standard CanBuildFrom instance for CC objects

    The standard CanBuildFrom instance for CC objects. The created value is an instance of class GenericCanBuildFrom, which forwards calls to create a new builder to the genericBuilder method of the requesting collection.

    attributes: implicit
    Go to: companion
  3. def concat[A](xss: Traversable[A]*): CC[A]

    Concatenates all argument collections into a single collection

    Concatenates all argument collections into a single collection.

    xss

    the collections that are to be concatenated.

    returns

    the concatenation of all the collections.

    definition classes: TraversableFactory
    Go to: companion
  4. def empty[A]: List[A]

    The empty collection of type CC[A]

    The empty collection of type CC[A]

    definition classes: ListGenericCompanion
    Go to: companion
  5. def equals(arg0: Any): Boolean

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence

    This method is used to compare the receiver object (this) with the argument object (arg0) for equivalence.

    The default implementations of this method is an equivalence relation:

    • It is reflexive: for any instance x of type Any, x.equals(x) should return true.
    • It is symmetric: for any instances x and y of type Any, x.equals(y) should return true if and only if y.equals(x) returns true.
    • It is transitive: for any instances x, y, and z of type AnyRef if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.

    If you override this method, you should verify that your implementation remains an equivalence relation. Additionally, when overriding this method it is often necessary to override hashCode to ensure that objects that are "equal" (o1.equals(o2) returns true) hash to the same Int (o1.hashCode.equals(o2.hashCode)).

    arg0

    the object to compare against this object for equality.

    returns

    true if the receiver object is equivalent to the argument; false otherwise.

    definition classes: AnyRef ⇐ Any
    Go to: companion
  6. def exists2[A, B](xs: List[A], ys: List[B])(f: (A, B) ⇒ Boolean): Boolean

    Tests whether the given predicate p holds for some corresponding elements of the argument lists

    Tests whether the given predicate p holds for some corresponding elements of the argument lists.

    Go to: companion
  7. def fill[A](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(elem: ⇒ A): CC[CC[CC[CC[CC[A]]]]]

    Produces a five-dimensional collection containing the results of some element computation a number of times

    Produces a five-dimensional collection containing the results of some element computation a number of times.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    n3

    the number of elements in the 3nd dimension

    n4

    the number of elements in the 4th dimension

    n5

    the number of elements in the 5th dimension

    elem

    the element computation

    returns

    A collection that contains the results of n1 x n2 x n3 x n4 x n5 evaluations of elem.

    definition classes: TraversableFactory
    Go to: companion
  8. def fill[A](n1: Int, n2: Int, n3: Int, n4: Int)(elem: ⇒ A): CC[CC[CC[CC[A]]]]

    Produces a four-dimensional collection containing the results of some element computation a number of times

    Produces a four-dimensional collection containing the results of some element computation a number of times.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    n3

    the number of elements in the 3nd dimension

    n4

    the number of elements in the 4th dimension

    elem

    the element computation

    returns

    A collection that contains the results of n1 x n2 x n3 x n4 evaluations of elem.

    definition classes: TraversableFactory
    Go to: companion
  9. def fill[A](n1: Int, n2: Int, n3: Int)(elem: ⇒ A): CC[CC[CC[A]]]

    Produces a three-dimensional collection containing the results of some element computation a number of times

    Produces a three-dimensional collection containing the results of some element computation a number of times.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    n3

    the number of elements in the 3nd dimension

    elem

    the element computation

    returns

    A collection that contains the results of n1 x n2 x n3 evaluations of elem.

    definition classes: TraversableFactory
    Go to: companion
  10. def fill[A](n1: Int, n2: Int)(elem: ⇒ A): CC[CC[A]]

    Produces a two-dimensional collection containing the results of some element computation a number of times

    Produces a two-dimensional collection containing the results of some element computation a number of times.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    elem

    the element computation

    returns

    A collection that contains the results of n1 x n2 evaluations of elem.

    definition classes: TraversableFactory
    Go to: companion
  11. def fill[A](n: Int)(elem: ⇒ A): CC[A]

    Produces a collection containing the results of some element computation a number of times

    Produces a collection containing the results of some element computation a number of times.

    n

    the number of elements contained in the collection.

    elem

    the element computation

    returns

    A collection that contains the results of n evaluations of elem.

    definition classes: TraversableFactory
    Go to: companion
  12. def flatten[A](xss: List[List[A]]): List[A]

    Concatenate all the elements of a given list of lists

    Concatenate all the elements of a given list of lists.

    xss

    the list of lists that are to be concatenated

    returns

    the concatenation of all the lists

    Go to: companion
  13. def forall2[A, B](xs: List[A], ys: List[B])(f: (A, B) ⇒ Boolean): Boolean

    Tests whether the given predicate p holds for all corresponding elements of the argument lists

    Tests whether the given predicate p holds for all corresponding elements of the argument lists.

    Go to: companion
  14. def fromArray[A](arr: Array[A], start: Int, len: Int): List[A]

    Converts a range of an array into a list

    Converts a range of an array into a list.

    arr

    the array to convert

    start

    the first index to consider

    len

    the lenght of the range to convert

    returns

    a list that contains the same elements than arr in the same order

    Go to: companion
  15. def fromArray[A](arr: Array[A]): List[A]

    Converts an array into a list

    Converts an array into a list.

    arr

    the array to convert

    returns

    a list that contains the same elements than arr in the same order

    Go to: companion
  16. def fromIterator[A](it: Iterator[A]): List[A]

    Converts an iterator to a list

    Converts an iterator to a list.

    it

    the iterator to convert

    returns

    a list that contains the elements returned by successive calls to it.next

    Go to: companion
  17. def fromString(str: String, separator: Char): List[String]

    Parses a string which contains substrings separated by a separator character and returns a list of all substrings

    Parses a string which contains substrings separated by a separator character and returns a list of all substrings.

    str

    the string to parse

    separator

    the separator character

    returns

    the list of substrings

    Go to: companion
  18. def hashCode(): Int

    Returns a hash code value for the object

    Returns a hash code value for the object.

    The default hashing algorithm is platform dependent.

    Note that it is allowed for two objects to have identical hash codes (o1.hashCode.equals(o2.hashCode)) yet not be equal (o1.equals(o2) returns false). A degenerate implementation could always return 0. However, it is required that if two objects are equal (o1.equals(o2) returns true) that they have identical hash codes (o1.hashCode.equals(o2.hashCode)). Therefore, when overriding this method, be sure to verify that the behavior is consistent with the equals method.

    definition classes: AnyRef ⇐ Any
    Go to: companion
  19. def iterate[A](start: A, len: Int)(f: (A) ⇒ A): CC[A]

    Produces a collection containing repeated applications of a function to a start value

    Produces a collection containing repeated applications of a function to a start value.

    start

    the start value of the collection

    len

    the number of elements contained inthe collection

    f

    the function that's repeatedly applied

    returns

    a collection with len values in the sequence start, f(start), f(f(start)), ...

    definition classes: TraversableFactory
    Go to: companion
  20. def lefts[A, B](es: Iterable[Either[A, B]]): List[A]

    Returns the Left values in the given Iterableof Eithers

    Returns the Left values in the given Iterableof Eithers.

    Go to: companion
  21. def make[A](n: Int, elem: A): List[A]

    Create a list containing several copies of an element

    Create a list containing several copies of an element.

    n

    the length of the resulting list

    elem

    the element composing the resulting list

    returns

    a list composed of n elements all equal to elem

    Go to: companion
  22. def map2[A, B, C](xs: List[A], ys: List[B])(f: (A, B) ⇒ C): List[C]

    Returns the list resulting from applying the given function f to corresponding elements of the argument lists

    Returns the list resulting from applying the given function f to corresponding elements of the argument lists.

    f

    function to apply to each pair of elements.

    returns

    [f(a0,b0), ..., f(an,bn)] if the lists are [a0, ..., ak], [b0, ..., bl] and n = min(k,l)

    Go to: companion
  23. def map3[A, B, C, D](xs: List[A], ys: List[B], zs: List[C])(f: (A, B, C) ⇒ D): List[D]

    Returns the list resulting from applying the given function f to corresponding elements of the argument lists

    Returns the list resulting from applying the given function f to corresponding elements of the argument lists.

    f

    function to apply to each pair of elements.

    returns

    [f(a0,b0,c0), ..., f(an,bn,cn)] if the lists are [a0, ..., ak], [b0, ..., bl], [c0, ..., cm] and n = min(k,l,m)

    Go to: companion
  24. def mapConserve[A <: AnyRef](xs: List[A])(f: (A) ⇒ A): List[A]

    Like xs map f, but returns xs unchanged if function f maps all elements to themselves

    Like xs map f, but returns xs unchanged if function f maps all elements to themselves.

    Go to: companion
  25. def newBuilder[A]: Builder[A, List[A]]

    The default builder for CC objects

    The default builder for CC objects.

    definition classes: ListGenericCompanion
    Go to: companion
  26. def range(start: Int, end: Int, step: (Int) ⇒ Int): List[Int]

    Create a sorted list with element valuesvn+1 = step(vn)where v0 = startand elements are in the range between start (inclusive) and end (exclusive)

    Create a sorted list with element valuesvn+1 = step(vn)where v0 = startand elements are in the range between start (inclusive) and end (exclusive)

    start

    the start value of the list

    end

    the end value of the list

    step

    the increment function of the list, which given vn, computes vn+1. Must be monotonically increasing or decreasing.

    returns

    the sorted list of all integers in range [start;end).

    Go to: companion
  27. def range(start: Int, end: Int, step: Int): CC[Int]

    Produces a collection containing equally spaced values in some integer interval

    Produces a collection containing equally spaced values in some integer interval.

    start

    the start value of the collection

    end

    the end value of the collection (the first value NOT contained)

    step

    the difference between successive elements of the collection (must be positive or negative)

    returns

    a collection with values start, start + step, ... up to, but excluding end

    definition classes: TraversableFactory
    Go to: companion
  28. def range(start: Int, end: Int): CC[Int]

    Produces a collection containing a sequence of increasing of integers

    Produces a collection containing a sequence of increasing of integers.

    end

    the end value of the collection (the first value NOT contained)

    returns

    a collection with values start, start + 1, ..., end - 1

    definition classes: TraversableFactory
    Go to: companion
  29. def rights[A, B](es: Iterable[Either[A, B]]): List[B]

    Returns the Right values in the givenIterable of Eithers

    Returns the Right values in the givenIterable of Eithers.

    Go to: companion
  30. def separate[A, B](es: Iterable[Either[A, B]]): (List[A], List[B])

    Transforms an Iterable of Eithers into a pair of lists

    Transforms an Iterable of Eithers into a pair of lists.

    Go to: companion
  31. def tabulate[A](n1: Int, n2: Int, n3: Int, n4: Int, n5: Int)(f: (Int, Int, Int, Int, Int) ⇒ A): CC[CC[CC[CC[CC[A]]]]]

    Produces a five-dimensional collection containing values of a given function over ranges of integer values starting from 0

    Produces a five-dimensional collection containing values of a given function over ranges of integer values starting from 0.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    n3

    the number of elements in the 3nd dimension

    n4

    the number of elements in the 4th dimension

    n5

    the number of elements in the 5th dimension

    f

    The function computing element values

    returns

    A collection consisting of elements f(i1, i2, i3, i4, i5) for 0 <= i1 < n1, 0 <= i2 < n2, 0 <= i3 < n3, 0 <= i4 < n4, and 0 <= i5 < n5.

    definition classes: TraversableFactory
    Go to: companion
  32. def tabulate[A](n1: Int, n2: Int, n3: Int, n4: Int)(f: (Int, Int, Int, Int) ⇒ A): CC[CC[CC[CC[A]]]]

    Produces a four-dimensional collection containing values of a given function over ranges of integer values starting from 0

    Produces a four-dimensional collection containing values of a given function over ranges of integer values starting from 0.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    n3

    the number of elements in the 3nd dimension

    n4

    the number of elements in the 4th dimension

    f

    The function computing element values

    returns

    A collection consisting of elements f(i1, i2, i3, i4) for 0 <= i1 < n1, 0 <= i2 < n2, 0 <= i3 < n3, and 0 <= i4 < n4.

    definition classes: TraversableFactory
    Go to: companion
  33. def tabulate[A](n1: Int, n2: Int, n3: Int)(f: (Int, Int, Int) ⇒ A): CC[CC[CC[A]]]

    Produces a three-dimensional collection containing values of a given function over ranges of integer values starting from 0

    Produces a three-dimensional collection containing values of a given function over ranges of integer values starting from 0.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    n3

    the number of elements in the 3nd dimension

    f

    The function computing element values

    returns

    A collection consisting of elements f(i1, i2, i3) for 0 <= i1 < n1, 0 <= i2 < n2, and 0 <= i3 < n3.

    definition classes: TraversableFactory
    Go to: companion
  34. def tabulate[A](n1: Int, n2: Int)(f: (Int, Int) ⇒ A): CC[CC[A]]

    Produces a two-dimensional collection containing values of a given function over ranges of integer values starting from 0

    Produces a two-dimensional collection containing values of a given function over ranges of integer values starting from 0.

    n1

    the number of elements in the 1st dimension

    n2

    the number of elements in the 2nd dimension

    f

    The function computing element values

    returns

    A collection consisting of elements f(i1, i2) for 0 <= i1 < n1 and 0 <= i2 < n2.

    definition classes: TraversableFactory
    Go to: companion
  35. def tabulate[A](n: Int)(f: (Int) ⇒ A): CC[A]

    Produces a collection containing values of a given function over a range of integer values starting from 0

    Produces a collection containing values of a given function over a range of integer values starting from 0.

    n

    The number of elements in the collection

    f

    The function computing element values

    returns

    A collection consisting of elements f(0), ..., f(n -1)

    definition classes: TraversableFactory
    Go to: companion
  36. def toString(xs: List[Char]): String

    Returns the given list of characters as a string

    Returns the given list of characters as a string.

    xs

    the list to convert.

    returns

    the list in form of a string.

    Go to: companion
  37. def toString(): String

    Returns a string representation of the object

    Returns a string representation of the object.

    The default representation is platform dependent.

    definition classes: AnyRef ⇐ Any
    Go to: companion
  38. def transpose[A](xss: List[List[A]]): List[List[A]]

    Transposes a list of lists

    Transposes a list of lists. pre: All element lists have the same length.

    xss

    the list of lists

    returns

    the transposed list of lists

    Go to: companion
  39. def unapplySeq[A](x: CC[A]): Some[CC[A]]

    This method is called in a pattern match { case Seq(

    This method is called in a pattern match { case Seq(...) => }.

    x

    the selector value

    returns

    sequence wrapped in an option, if this is a Seq, otherwise none

    definition classes: SeqFactory
    Go to: companion
  40. def unzip[A, B](xs: Iterable[(A, B)]): (List[A], List[B])

    Transforms an iterable of pairs into a pair of lists

    Transforms an iterable of pairs into a pair of lists.

    xs

    the iterable of pairs to unzip

    returns

    a pair of lists.

    Go to: companion
  41. def unzip[A, B](xs: List[(A, B)]): (List[A], List[B])

    Transforms a list of pairs into a pair of lists

    Transforms a list of pairs into a pair of lists.

    xs

    the list of pairs to unzip

    returns

    a pair of lists.

    Go to: companion