in scala
object List

object List
extends java.lang.Object
with scala.ScalaObject
This object provides methods for creating specialized lists, and for transforming special kinds of lists (e.g. lists of lists).
Author:
Martin Odersky and others
Version:
1.0, 15/07/2003

Constructor Summary
def this

Def Summary
def apply [A] (xs: A*) : scala.List[A]
Create a list with given elements.
def concat [a] (xss: scala.List[a]*) : scala.List[a]
Concatenate all the argument lists into a single list.
def exists2 [a, b] (xs: scala.List[a], ys: scala.List[b])(f: (a, b) => scala.Boolean) : scala.Boolean
Tests whether the given predicate p holds for some corresponding elements of the argument lists.
def flatten [a] (xss: scala.List[scala.List[a]]) : scala.List[a]
Concatenate all the elements of a given list of lists.
def forall2 [a, b] (xs: scala.List[a], ys: scala.List[b])(f: (a, b) => scala.Boolean) : scala.Boolean
Tests whether the given predicate p holds for all corresponding elements of the argument lists.
def fromArray [a] (arr: scala.Array[a]) : scala.List[a]
Converts an array into a list.
def fromArray [a] (arr: scala.Array[a], start: scala.Int, len: scala.Int) : scala.List[a]
Converts a range of an array into a list.
def fromIterator [a] (it: scala.Iterator[a]) : scala.List[a]
Converts an iterator to a list
def fromString (str: java.lang.String) : scala.List[scala.Char]
Returns the given string as a list of characters.
def fromString (str: java.lang.String, separator: scala.Char) : scala.List[java.lang.String]
Parses a string which contains substrings separated by a separator character and returns a list of all substrings.
def make [a] (n: scala.Int, elem: a) : scala.List[a]
Create a list containing several copies of an element.
def map2 [a, b, c] (xs: scala.List[a], ys: scala.List[b])(f: (a, b) => c) : scala.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: scala.List[a], ys: scala.List[b], zs: scala.List[c])(f: (a, b, c) => d) : scala.List[d]
Returns the list resulting from applying the given function f to corresponding elements of the argument lists.
def mapConserve [a <: java.lang.Object] (xs: scala.List[a])(f: (a) => a) : scala.List[a]
Like xs map f, but returns xs unchanged if function f maps all elements to themselves.
def range (from: scala.Int, end: scala.Int) : scala.List[scala.Int]
Create a sorted list of all integers in a range.
def range (from: scala.Int, end: scala.Int, step: (scala.Int) => scala.Int) : scala.List[scala.Int]
Create a sorted list of all integers in a range.
def range (from: scala.Int, end: scala.Int, step: scala.Int) : scala.List[scala.Int]
Create a sorted list of all integers in a range.
def tabulate [a] (n: scala.Int, maker: (scala.Int) => a) : scala.List[a]
Create a list by applying a function to successive integers.
def toString (xs: scala.List[scala.Char]) : java.lang.String
Returns the given list of characters as a string.
def transpose [a] (xss: scala.List[scala.List[a]]) : scala.List[scala.List[a]]
Transposes a list of lists. pre: All element lists have the same length.
def unapplySeq [A] (x: scala.List[A]) : scala.Option[scala.List[A]]
for unapply matching
def unzip [a, b] (xs: scala.List[scala.Tuple2[a, b]]) : scala.Tuple2[scala.List[a], scala.List[b]]
Transforms a list of pair into a pair of lists.
Constructor Detail
def this

Def Detail
def apply [A](xs: A*): scala.List[A]
Create a list with given elements.
Parameters:
xs - the elements to put in the list
Returns:
the list containing elements xs.

def concat [a](xss: scala.List[a]*): scala.List[a]
Concatenate all the argument lists into a single list.
Parameters:
xss - the lists that are to be concatenated
Returns:
the concatenation of all the lists

def exists2 [a, b](xs: scala.List[a], ys: scala.List[b])(f: (a, b) => scala.Boolean): scala.Boolean
Tests whether the given predicate p holds for some corresponding elements of the argument lists.
Parameters:
p - function to apply to each pair of elements.
Returns:
n != 0 && (p(a0,b0) || ... || p(an,bn))] if the lists are [a0, ..., ak], [b0, ..., bl] and m = min(k,l)

def flatten [a](xss: scala.List[scala.List[a]]): scala.List[a]
Concatenate all the elements of a given list of lists.
Parameters:
xss - the list of lists that are to be concatenated
Returns:
the concatenation of all the lists

def forall2 [a, b](xs: scala.List[a], ys: scala.List[b])(f: (a, b) => scala.Boolean): scala.Boolean
Tests whether the given predicate p holds for all corresponding elements of the argument lists.
Parameters:
p - function to apply to each pair of elements.
Returns:
n == 0 || (p(a0,b0) && ... && p(an,bn))] if the lists are [a0, ..., ak]; [b0, ..., bl] and m = min(k,l)

def fromArray [a](arr: scala.Array[a]): scala.List[a]
Converts an array into a list.
Parameters:
arr - the array to convert
Returns:
a list that contains the same elements than arr in the same order

def fromArray [a](arr: scala.Array[a], start: scala.Int, len: scala.Int): scala.List[a]
Converts a range of an array into a list.
Parameters:
arr - the array to convert
Parameters:
start - the first index to consider
Parameters:
len - the lenght of the range to convert
Returns:
a list that contains the same elements than arr in the same order

def fromIterator [a](it: scala.Iterator[a]): scala.List[a]
Converts an iterator to a list
Parameters:
it - the iterator to convert
Returns:
a list that contains the elements returned by successive calls to it.next

def fromString (str: java.lang.String): scala.List[scala.Char]
Returns the given string as a list of characters.
Parameters:
str - the string to convert.
Returns:
the string as a list of characters.

def fromString (str: java.lang.String, separator: scala.Char): scala.List[java.lang.String]
Parses a string which contains substrings separated by a separator character and returns a list of all substrings.
Parameters:
str - the string to parse
Parameters:
separator - the separator character
Returns:
the list of substrings

def make [a](n: scala.Int, elem: a): scala.List[a]
Create a list containing several copies of an element.
Parameters:
n - the length of the resulting list
Parameters:
elem - the element composing the resulting list
Returns:
a list composed of n elements all equal to elem

def map2 [a, b, c](xs: scala.List[a], ys: scala.List[b])(f: (a, b) => c): scala.List[c]
Returns the list resulting from applying the given function f to corresponding elements of the argument lists.
Parameters:
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)

def map3 [a, b, c, d](xs: scala.List[a], ys: scala.List[b], zs: scala.List[c])(f: (a, b, c) => d): scala.List[d]
Returns the list resulting from applying the given function f to corresponding elements of the argument lists.
Parameters:
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)

def mapConserve [a <: java.lang.Object](xs: scala.List[a])(f: (a) => a): scala.List[a]
Like xs map f, but returns xs unchanged if function f maps all elements to themselves.
Parameters:
xs - ...
Parameters:
f - ...
Returns:
...

def range (from: scala.Int, end: scala.Int): scala.List[scala.Int]
Create a sorted list of all integers in a range.
Parameters:
from - the start value of the list
Parameters:
end - the end value of the list
Returns:
the sorted list of all integers in range [from;end).

def range (from: scala.Int, end: scala.Int, step: (scala.Int) => scala.Int): scala.List[scala.Int]
Create a sorted list of all integers in a range.
Parameters:
from - the start value of the list
Parameters:
end - the end value of the list
Parameters:
step - the increment function of the list
Returns:
the sorted list of all integers in range [from;end).

def range (from: scala.Int, end: scala.Int, step: scala.Int): scala.List[scala.Int]
Create a sorted list of all integers in a range.
Parameters:
from - the start value of the list
Parameters:
end - the end value of the list
Parameters:
step - the increment value of the list
Returns:
the sorted list of all integers in range [from;end).

def tabulate [a](n: scala.Int, maker: (scala.Int) => a): scala.List[a]
Create a list by applying a function to successive integers.
Parameters:
n - the length of the resulting list
Parameters:
maker - the procedure which, given an integer n, returns the nth element of the resulting list, where n is in interval [0;n).
Returns:
the list obtained by applying the maker function to successive integers from 0 to n (exclusive).

def toString (xs: scala.List[scala.Char]): java.lang.String
Returns the given list of characters as a string.
Parameters:
xs - the list to convert.
Returns:
the list in form of a string.

def transpose [a](xss: scala.List[scala.List[a]]): scala.List[scala.List[a]]
Transposes a list of lists. pre: All element lists have the same length.

def unapplySeq [A](x: scala.List[A]): scala.Option[scala.List[A]]
for unapply matching

def unzip [a, b](xs: scala.List[scala.Tuple2[a, b]]): scala.Tuple2[scala.List[a], scala.List[b]]
Transforms a list of pair into a pair of lists.
Parameters:
xs - the list of pairs to unzip
Returns:
a pair of lists: the first list in the pair contains the list