Scala Library Documentation
|
|
scala/List.scala
]
object
List
extends
AnyRefMethod Summary | |
def
|
apply
[A](xs : A*) : List[A]
Create a list with given elements.
|
def
|
concat
[a](xss : List[a]*) : List[a]
Concatenate all the argument lists into a single list.
|
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. |
def
|
flatten
[a](xss : List[List[a]]) : List[a]
Concatenate all the elements of a given list of lists.
|
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. |
def
|
fromArray
[a](arr : Array[a]) : List[a]
Converts an array into a list.
|
def
|
fromArray
[a](arr : Array[a], start : Int, len : Int) : List[a]
Converts a range of an array into a list.
|
def
|
fromIterator
[a](it : Iterator[a]) : List[a]
Converts an iterator to a list
|
def
|
fromString
(str : String) : List[Char]
Returns the given string as a list of characters.
|
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.
|
def
|
make
[a](n : Int, elem : a) : List[a]
Create a list containing several copies of an element.
|
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. |
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. |
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. |
def
|
range
(from : Int, end : Int) : List[Int]
Create a sorted list of all integers in a range.
|
def
|
range
(from : Int, end : Int, step : Int) : List[Int]
Create a sorted list of all integers in a range.
|
def
|
range
(from : Int, end : Int, step : (Int) => Int) : List[Int]
Create a sorted list of all integers in a range.
|
def
|
tabulate
[a](n : Int, maker : (Int) => a) : List[a]
Create a list by applying a function to successive integers.
|
def
|
toString
(xs : List[Char]) : String
Returns the given list of characters as a string.
|
def
|
transpose
[a](xss : List[List[a]]) : List[List[a]]
Transposes a list of lists.
pre: All element lists have the same length.
|
def
|
unapplySeq
[A](x : List[A]) : Option[List[A]]
for unapply matching
|
def
|
unzip
[a, b](xs : List[(a, b)]) : (List[a], List[b])
Transforms a list of pair into a pair of lists.
|
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Method Details |
xs -
the elements to put in the listfrom -
the start value of the listend -
the end value of the listfrom -
the start value of the listend -
the end value of the liststep -
the increment value of the listfrom -
the start value of the listend -
the end value of the liststep -
the increment function of the listn -
the length of the resulting listelem -
the element composing the resulting listn -
the length of the resulting listmaker -
the procedure which, given an integer n
, returns the nth element of the resulting list, where
n
is in interval [0;n)
.xss -
the list of lists that are to be concatenatedxss -
the lists that are to be concatenatedxs -
the list of pairs to unzipit -
the iterator to convertit.next
arr -
the array to convertarr
in the same orderarr -
the array to convertstart -
the first index to considerlen -
the lenght of the range to convertarr
in the same orderstr -
the string to parseseparator -
the separator characterstr -
the string to convert.xs -
the list to convert.xs
unchanged if function
f
maps all elements to themselves.xs -
...f -
...f
to corresponding elements of the argument lists.f -
function to apply to each pair of elements.[f(a0,b0), ..., f(an,bn)]
if the lists are [a0, ..., ak]
, [b0, ..., bl]
and
n = min(k,l)
f
to
corresponding elements of the argument lists.f -
function to apply to each pair of elements.[f(a0,b0,c0), ..., f(an,bn,cn)]
if the lists are [a0, ..., ak]
, [b0, ..., bl]
, [c0, ..., cm]
and
n = min(k,l,m)
p
holds
for all corresponding elements of the argument lists.p -
function to apply to each pair of elements.n == 0 || (p(a0,b0) && ... && p(an,bn))]
if the lists are [a0, ..., ak]
;
[b0, ..., bl]
and m = min(k,l)
p
holds
for some corresponding elements of the argument lists.p -
function to apply to each pair of elements.n != 0 && (p(a0,b0) || ... || p(an,bn))]
if the lists are [a0, ..., ak]
, [b0, ..., bl]
and
m = min(k,l)
Scala Library Documentation
|
|