Scala Library
|
|
scala/collection/immutable/List.scala
]
object
List
extends
SeqFactory[List]Method Summary | |
override def
|
apply
[A](xs : A*) : List[A]
Creates an iterable of type
CC with specified elements. |
implicit def
|
canBuildFrom [A] : CanBuildFrom[List, A, List[A]] |
override def
|
empty
[A] : List[A]
The empty iterable of type
CC . |
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], start : Int, len : Int) : List[A]
Converts a range of an array into a list.
|
def
|
fromArray
[A](arr : Array[A]) : List[A]
Converts an array into a list.
|
def
|
fromIterator
[A](it : Iterator[A]) : List[A]
Converts an iterator to a list.
|
def
|
fromString
(str : java.lang.String) : List[Char]
Returns the given string as a list of characters.
|
def
|
lefts
[A, B](es : Iterable[Either[A, B]]) : List[A]
Returns the
Left values in the given Iterable
of Either s. |
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
|
newBuilder [A] : Builder[A, List[A]] |
def
|
range
(start : Int, end : Int, step : (Int) => Int) : List[Int]
Create a sorted list with element values
vn+1 = step(vn)
where v0 = start
and elements are in the range between start (inclusive)
and end (exclusive) |
def
|
rights
[A, B](es : Iterable[Either[A, B]]) : List[B]
Returns the
Right values in the givenIterable of Either s. |
def
|
separate
[A, B](es : Iterable[Either[A, B]]) : (List[A], List[B])
Transforms an Iterable of Eithers into a pair of lists.
|
def
|
toString
(xs : List[Char]) : java.lang.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
|
unzip
[A, B](xs : List[(A, B)]) : (List[A], List[B])
Transforms a list of pairs into a pair of lists.
|
def
|
unzip
[A, B](xs : Iterable[(A, B)]) : (List[A], List[B])
Transforms an iterable of pairs into a pair of lists.
|
Methods inherited from SeqFactory | |
unapplySeq |
Methods inherited from TraversableFactory | |
concat, fill, fill, fill, fill, fill, tabulate, tabulate, tabulate, tabulate, tabulate, range, range, iterate |
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 |
implicit
def
canBuildFrom[A] : CanBuildFrom[List, A, List[A]]
CC
.CC
with specified elements.
def
range(start : Int, end : Int, step : (Int) => Int) : List[Int]
vn+1 = step(vn)
where v0 = start
and elements are in the range between start
(inclusive)
and end
(exclusive)start -
the start value of the listend -
the end value of the liststep -
the increment function of the list, which given vn
, computes vn+1
. Must be monotonically increasing
or decreasing.
def
make[A](n : Int, elem : A) : List[A]
n -
the length of the resulting listelem -
the element composing the resulting listxss -
the list of lists that are to be concatenatedxs -
the list of pairs to unzipxs -
the iterable of pairs to unzipLeft
values in the given Iterable
of Either
s.Right
values in the givenIterable
of Either
s.
def
separate[A, B](es : Iterable[Either[A, B]]) : (List[A], List[B])
xs -
the iterable of Eithers to separate
def
fromIterator[A](it : Iterator[A]) : List[A]
it -
the iterator to convertit.next
def
fromArray[A](arr : Array[A]) : List[A]
arr -
the array to convertarr
in the same order
def
fromArray[A](arr : Array[A], start : Int, len : Int) : List[A]
arr -
the array to convertstart -
the first index to considerlen -
the lenght of the range to convertarr
in the same order
def
fromString(str : java.lang.String) : List[Char]
str -
the string to convert.
def
toString(xs : List[Char]) : java.lang.String
xs -
the list to convert.
def
mapConserve[A <: AnyRef](xs : List[A])(f : (A) => A) : List[A]
xs
unchanged if function
f
maps all elements to themselves.
def
map2[A, B, C](xs : List[A], ys : List[B])(f : (A, B) => C) : List[C]
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)
def
map3[A, B, C, D](xs : List[A], ys : List[B], zs : List[C])(f : (A, B, C) => D) : List[D]
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)
def
forall2[A, B](xs : List[A], ys : List[B])(f : (A, B) => Boolean) : Boolean
p
holds
for all corresponding elements of the argument lists.p -
function to apply to each pair of elements.(p(a0,b0) && ... && p(an,bn))]
if the lists are [a0, ..., ak]
;
[b0, ..., bl]
and n = min(k,l)
def
exists2[A, B](xs : List[A], ys : List[B])(f : (A, B) => Boolean) : Boolean
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
n = min(k,l)
xss -
the list of lists
Scala Library
|
|