| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |
sealed abstract class List[+ A]
extends
Seq[A] with Product
a. This class comes with two implementing case
classes scala.Nil and scala.:: that
implement the abstract members isEmpty,
head and tail.
- Martin Odersky and others - 1.0, 16/07/2003
def this
|
| elements |
override def elements
Returns the elements in the list as an iterator
[details]
|
Iterator[A] | |
| first |
def first
Returns the first element of this list
[details]
|
A | Seq |
| firstOption |
def firstOption
Returns as an option the first element of this list or
None if list is empty
[details]
|
Option[A] | Seq |
| hasDefiniteSize |
def hasDefiniteSize
returns true iff this collection has a bound size
[details]
Many APIs in this trait will not work on collections of
unbound sizes.
|
Boolean | Iterable |
| head |
abstract def head
Returns this first element of the list
[details]
|
A | |
| headOption |
def headOption
|
Option[A] | Seq |
| indices |
def indices
Creates a list with all indices in the list
[details]
This is
equivalent to a call to
List.range(0, xs.length).
|
List[Int] | |
| init |
def init
Returns the list without its last element
[details]
|
List[A] | |
| isEmpty |
override abstract def isEmpty
Returns true if the list does not contain any elements
[details]
|
Boolean | |
| last |
override def last
Returns the last element of this list
[details]
|
A | |
| lastOption |
def lastOption
Returns as an option the last element of this list or
None if list is empty
[details]
|
Option[A] | Seq |
| length |
def length
Returns the number of elements in the list
[details]
|
Int | |
| mkString |
def mkString
Converts a collection into a flat
String by each element's toString method
[details]
|
String | Iterable |
| productArity |
abstract def productArity
return k for a product
A(x_1,
[details]
|
Int | Product |
| productPrefix |
def productPrefix
By default the empty string
[details]
Implementations may override this
method in order to prepend a string prefix to the result of the
toString methods.
|
String | Product |
| projection |
override def projection
returns a projection that can be used to call non-strict
filter,
map, and flatMap methods that build projections
of the collection
|
Stream[A] | |
| removeDuplicates |
def removeDuplicates
Removes redundant elements from the list
[details]
Uses the method
==
to decide if two elements are identical.
|
List[A] | |
| reverse |
override def reverse
A list consisting of all elements of this list in reverse order
|
List[A] | |
| size |
def size
should always be
length
|
Int | Seq |
| stringPrefix |
protected override def stringPrefix
Defines the prefix of this object's
toString representation
|
String | |
| tail |
abstract def tail
Returns this list without its first element
[details]
|
List[A] | |
| toList |
override def toList
Overrides the method in Iterable for efficiency
[details]
|
List[A] | |
| toSeq |
override def toSeq
Overridden for efficiency
[details]
|
Seq[A] | Seq |
| toStream |
override def toStream
Returns a stream containing all of the elements in this iterable object
[details]
|
Stream[A] |
| != |
final def !=(arg0 : Object)
|
Boolean | AnyRef |
| != |
final def !=(arg0 : Any)
o != arg0 is the same as !(o == (arg0))
[details]
|
Boolean | Any |
| + |
def +[B >: A](x : B)
Add an element
|
List[B] | |
| ++ |
override def ++[B >: A](that : Iterable[B])
Appends two list objects
|
List[B] | |
| - |
def -[B >: A](x : B)
Computes the difference between this list and the given object
x
[details]
|
List[B] | |
| -- |
def --[B >: A](that : List[B])
Computes the difference between this list and the given list
that
[details]
|
List[B] | |
| /: |
def /:[B](z : B)(op : (B, A) => B)
Similar to
foldLeft but can be used as
an operator with the order of list and zero arguments reversed
[details]
That is,
z /: xs is the same as xs foldLeft z
|
B | Iterable |
| :: |
def ::[B >: A](x : B)
Add an element
|
List[B] | |
| ::: |
def :::[B >: A](prefix : List[B])
Returns a list resulting from the concatenation of the given
list
|
List[B] | |
| :\ |
def :\[B](z : B)(op : (A, B) => B)
An alias for
foldRight
[details]
That is,
xs :\ z is the same as xs foldRight z
|
B | Iterable |
| == |
final def ==(arg0 : Any)
o == arg0 is the same as o
[details]
|
Boolean | Any |
| == |
final def ==(arg0 : Object)
o == arg0 is the same as if (o eq null) arg0 eq null else o
[details]
|
Boolean | AnyRef |
| addString |
def addString(buf : StringBuilder)
Write all elements of this string into given string builder, with no separator string
between elements
[details]
|
StringBuilder | Iterable |
| addString |
def addString(buf : StringBuilder, start : String, sep : String, end : String)
Write all elements of this string into given string builder
[details]
|
StringBuilder | Iterable |
| addString |
def addString(buf : StringBuilder, sep : String)
Write all elements of this string into given string builder
[details]
|
StringBuilder | Iterable |
| andThen |
override def andThen[C](k : (B) => C)
(f andThen g)(x) == g(f(x))
|
PartialFunction[A, C] | PartialFunction |
| apply |
def apply(n : Int)
Returns the
n-th element of this list
[details]
The first element
(head of the list) is at position 0.
|
A | |
| asInstanceOf |
final def asInstanceOf[T0]
This method is used to cast the receiver object to be of type
T0
[details]
Note that the success of a cast at runtime is modulo Scala's
erasure semantics. Therefore the expression
|
T0 | Any |
| break |
def break(p : (A) => Boolean)
Like
span but with the predicate inverted
|
(List[A], List[A]) | |
| clone |
protected def clone
This method creates and returns a copy of the receiver object
[details]
The default implementation of the
|
Object | AnyRef |
| compose |
def compose[A](g : (A) => T1)
(f compose g)(x) == f(g(x))
|
(A) => R | Function1 |
| concat |
override def concat[B >: A](that : Iterable[B])
Appends two iterable objects
[details]
|
Seq[B] | Seq |
| contains |
def contains(elem : Any)
Tests if the given value
elem is a member of this
sequence
[details]
|
Boolean | Seq |
| containsSlice |
def containsSlice[B](that : Seq[B])
Is
that a slice in this?
|
Boolean | Seq |
| copyToArray |
def copyToArray[B >: A](xs : Array[B], start : Int)
Fills the given array
xs with the elements of
this sequence starting at position start
[details]
|
Unit | Iterable |
| copyToBuffer |
def copyToBuffer[B >: A](dest : Buffer[B])
Copy all elements to a given buffer
[details]
|
Unit | Iterable |
| count |
def count(p : (A) => Boolean)
Count the number of elements in the list which satisfy a predicate
[details]
|
Int | |
| diff |
def diff[B >: A](that : List[B])
Computes the difference between this list and the given list
that
[details]
|
List[B] | |
| drop |
override def drop(n : Int)
Returns the list without its
n first elements
[details]
If this list has less than
n elements, the empty list is returned.
|
List[A] | |
| dropRight |
def dropRight(n : Int)
Returns the list wihout its rightmost
n elements
[details]
|
List[A] | |
| dropWhile |
override def dropWhile(p : (A) => Boolean)
Returns the longest suffix of this list whose first element
does not satisfy the predicate
p
[details]
|
List[A] | |
| endsWith |
def endsWith[B](that : Seq[B])
[details]
|
Boolean | Seq |
| eq |
final def eq(arg0 : Object)
This method is used to test whether the argument (
arg0) is a reference to the
receiver object (this)
[details]
The
eq method has three other properties.
When overriding the
|
Boolean | AnyRef |
| equals |
def equals(arg0 : Any)
This method is used to compare the receiver object (
this)
with the argument object (arg0) for equivalence
[details]
The default implementations of this method is an equivalence relation:
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
|
Boolean | AnyRef |
| equalsWith |
def equalsWith[B](that : Seq[B])(f : (A, B) => Boolean)
|
Boolean | Seq |
| exists |
override def exists(p : (A) => Boolean)
Tests the existence in this list of an element that satisfies the
predicate
p
[details]
|
Boolean | |
| filter |
override final def filter(p : (A) => Boolean)
Returns all the elements of this list that satisfy the
predicate
p
[details]
The order of the elements is preserved.
It is guarenteed that the receiver list itself is returned iff all its
elements satisfy the predicate `p'. Hence the following equality is valid:
(xs filter p) eq xs == xs forall p
|
List[A] | |
| finalize |
protected def finalize
This method is called by the garbage collector on the receiver object when garbage
collection determines that there are no more references to the object
[details]
The details of when and if the |
Unit | AnyRef |
| find |
override def find(p : (A) => Boolean)
Find and return the first element of the list satisfying a
predicate, if any
[details]
|
Option[A] | |
| findIndexOf |
override def findIndexOf(p : (A) => Boolean)
Returns index of the first element satisying a predicate, or -1
[details]
|
Int | Seq |
| flatMap |
override final def flatMap[B](f : (A) => Iterable[B])
Applies the given function
f to each element of
this list, then concatenates the results
[details]
|
List[B] | |
| flatten |
def flatten[B](implicit f : (A) => Iterable[B])
Concatenate the elements of this list
[details]
The elements of this list
should be a
Iterables.
Note: The compiler might not be able to infer the type parameter.
|
List[B] | |
| foldLeft |
override def foldLeft[B](z : B)(f : (B, A) => B)
Combines the elements of this list together using the binary
function
f, from left to right, and starting with
the value z
[details]
|
B | |
| foldRight |
override def foldRight[B](z : B)(f : (A, B) => B)
Combines the elements of this list together using the binary
function
f, from right to left, and starting with
the value z
[details]
|
B | |
| forall |
override def forall(p : (A) => Boolean)
Tests if the predicate
p is satisfied by all elements
in this list
[details]
|
Boolean | |
| foreach |
override final def foreach(f : (A) => Unit)
Apply the given function
f to each element of this list
(while respecting the order of the elements)
[details]
|
Unit | |
| getClass |
final def getClass
Returns a representation that corresponds to the dynamic class of the receiver object
[details]
The nature of the representation is platform dependent.
|
Class[Any] | AnyRef |
| hashCode |
def hashCode
Returns a hash code value for the object
[details]
The default hashing algorithm is platform dependent.
Note that it is allowed for two objects to have identical hash
codes (
|
Int | AnyRef |
| indexOf |
override def indexOf[B >: A](elem : B)
Returns the index of the first occurence of the specified
object in this iterable object
[details]
|
Int | Seq |
| indexOf |
def indexOf[B >: A](that : Seq[B])
Searches for the argument sequence in the receiver object, returning
the smallest index where a match occurs
[details]
If the receiver object,
this, is an infinite sequence
this method will not terminate if there is no match. Similarly, if
the both the receiver object and the argument, that are
infinite sequences this method will not terminate.
Because both the receiver object and the argument can both potentially
be an infinite sequences, we do not attempt to use an optimized
searching algorithm. Therefore, the running time will be proportional
to the length of the receiver object and the argument. Subclasses and
traits can potentially provide an optimized implementation.
|
Int | Seq |
| intersect |
def intersect[B >: A](that : List[B])
Computes the intersection between this list and the given list
that
[details]
|
List[B] | |
| isDefinedAt |
def isDefinedAt(x : Int)
Is this partial function defined for the index
x?
[details]
|
Boolean | Seq |
| isInstanceOf |
final def isInstanceOf[T0]
This method is used to test whether the dynamic type of the receiver object is
T0
[details]
Note that the test result of the test is modulo Scala's erasure
semantics. Therefore the expression
|
Boolean | Any |
| lastIndexOf |
def lastIndexOf[B >: A](elem : B)
Returns the index of the last occurence of the specified element
in this sequence, or -1 if the sequence does not contain this element
[details]
|
Int | Seq |
| lengthCompare |
override def lengthCompare(l : Int)
Result of comparing
length with operand l
[details]
returns
x where
x < 0 iff this.length < l
x == 0 iff this.length == l
x > 0 iff this.length > that.
This method is used by matching streams against right-ignoring (...,_*) patterns.
This method does not call List.length, it works for O(l),
not for O(length).
|
Int | |
| map |
override final def map[B](f : (A) => B)
Returns the list resulting from applying the given function
f to each
element of this list
[details]
|
List[B] | |
| mkString |
def mkString(start : String, sep : String, end : String)
Returns a string representation of this iterable object
[details]
The resulting string
begins with the string
start and is finished by the string
end. Inside, the string representations of elements (w.r.t.
the method toString()) are separated by the string
sep.
|
String | Iterable |
| mkString |
def mkString(sep : String)
Returns a string representation of this iterable object
[details]
The string
representations of elements (w.r.t. the method
toString())
are separated by the string sep.
|
String | Iterable |
| ne |
final def ne(arg0 : Object)
o
[details]
|
Boolean | AnyRef |
| notify |
final def notify
Wakes up a single thread that is waiting on the receiver object's monitor
|
Unit | AnyRef |
| notifyAll |
final def notifyAll
Wakes up all threads that are waiting on the receiver object's monitor
|
Unit | AnyRef |
| orElse |
def orElse[A1 <: A, B1 >: B](that : PartialFunction[A1, B1])
|
PartialFunction[A1, B1] | PartialFunction |
| partition |
override def partition(p : (A) => Boolean)
Partition the list in two sub-lists according to a predicate
[details]
|
(List[A], List[A]) | |
| productElement |
abstract def productElement(n : Int)
for a product
A(x_1,
[details]
|
Any | Product |
| reduceLeft |
override def reduceLeft[B >: A](f : (B, A) => B)
Combines the elements of this list together using the binary
operator
op, from left to right
[details]
|
B | |
| reduceRight |
override def reduceRight[B >: A](f : (A, B) => B)
Combines the elements of this list together using the binary
operator
op, from right to left
[details]
|
B | |
| remove |
def remove(p : (A) => Boolean)
Removes all elements of the list which satisfy the predicate
p
[details]
This is like
filter with the
predicate inversed.
|
List[A] | |
| reverseMap |
def reverseMap[B](f : (A) => B)
Apply a function to all the elements of the list, and return the
reversed list of results
[details]
This is equivalent to a call to
map
followed by a call to reverse, but more efficient.
|
List[B] | |
| reverse_::: |
def reverse_:::[B >: A](prefix : List[B])
Reverse the given prefix and append the current list to that
[details]
This function is equivalent to an application of
reverse
on the prefix followed by a call to :::, but more
efficient (and tail recursive).
|
List[B] | |
| sameElements |
def sameElements[B >: A](that : Iterable[B])
Checks if the other iterable object contains the same elements
[details]
|
Boolean | Iterable |
| slice |
override def slice(start : Int, end : Int)
Returns the list with elements belonging to the given index range
[details]
|
List[A] | |
| slice |
def slice(from : Int)
A sub-sequence starting at index
from
and extending up to the length of the current sequence (non-strict)
[details]
|
Seq[A] | Seq |
| sort |
def sort(lt : (A, A) => Boolean)
Sort the list according to the comparison function
|
List[A] | |
| span |
def span(p : (A) => Boolean)
Returns the longest prefix of the list whose elements all satisfy
the given predicate, and the rest of the list
[details]
|
(List[A], List[A]) | |
| splitAt |
def splitAt(n : Int)
Split the list at a given point and return the two parts thus
created
[details]
|
(List[A], List[A]) | |
| startsWith |
def startsWith[B](that : Seq[B], offset : Int)
Checks whether the argument sequence is contained at the
specified index within the receiver object
[details]
If the both the receiver object,
this and
the argument, that are infinite sequences
this method may not terminate.
|
Boolean | Seq |
| startsWith |
def startsWith[B](that : Seq[B])
Check whether the receiver object starts with the argument sequence
[details]
|
Boolean | Seq |
| subseq |
def subseq(from : Int, end : Int)
Returns a subsequence starting from index
from
consisting of len elements
[details]
|
Seq[A] | Seq |
| synchronized |
final def synchronized[T0](arg0 : T0)
|
T0 | AnyRef |
| take |
override def take(n : Int)
Returns the
n first elements of this list, or else the whole
list, if it has less than n elements
[details]
|
List[A] | |
| takeRight |
def takeRight(n : Int)
Returns the rightmost
n elements from this list
[details]
|
List[A] | |
| takeWhile |
override def takeWhile(p : (A) => Boolean)
Returns the longest prefix of this list whose elements satisfy
the predicate
p
[details]
|
List[A] | |
| toArray |
override def toArray[B >: A]
Converts this sequence to a fresh Array with
length elements
|
Array[B] | Seq |
| toString |
override def toString
Returns a string representation of the object
[details]
The default representation is platform dependent.
|
String | Collection |
| union |
def union[B >: A](that : List[B])
Computes the union of this list and the given list
that
[details]
|
List[B] | |
| wait |
final def wait(arg0 : Long, arg1 : Int)
|
Unit | AnyRef |
| wait |
final def wait(arg0 : Long)
|
Unit | AnyRef |
| wait |
final def wait
|
Unit | AnyRef |
| zip |
def zip[B](that : List[B])
Returns a list formed from this list and the specified list
that by associating each element of the former with
the element at the same position in the latter
[details]
If one of the two lists is longer than the other, its remaining elements are ignored.
|
List[(A, B)] | |
| zipAll |
def zipAll[B, C >: A, D >: B](that : List[B], thisElem : C, thatElem : D)
Returns a list formed from this list and the specified list
that by associating each element of the former with
the element at the same position in the latter
[details]
|
List[(C, D)] | |
| zipWithIndex |
def zipWithIndex
Returns a list that pairs each element of this list
with its index, counting from 0
[details]
|
List[(A, Int)] |
| OVERVIEW | PACKAGE | CONSTR | FIELDS | METHODS | FRAMES NO FRAMES | INHERITED |