scala
trait SeqProxy

[source: `scala/SeqProxy.scala`]

`` `trait` SeqProxy[+A]
  `extends` Seq[A]`with` IterableProxy[A]

  This class implements a proxy for sequences. It forwards all calls to a different sequence object.

Author
  Martin Odersky
  Matthias Zenger
Version
  2.0, 31/12/2006

Direct Known Subclasses:
  PriorityQueueProxy, QueueProxy, StackProxy

Method Summary
`override def` | apply (i : Int) : A
`override def` | concat [B >: A](that : Iterable[B]) : Seq[B] Appends two iterable objects.
`override def` | contains (elem : Any) : Boolean Tests if the given value `elem` is a member of this sequence.
`override def` | copyToArray [B >: A](xs : Array[B], start : Int) : Unit Fills the given array `xs` with the elements of this sequence starting at position `start`.
`override def` | drop (n : Int) : Seq[A] Returns this sequence without its `n` first elements If this sequence has less than `n` elements, the empty sequence is returned.
`override def` | dropWhile (p : (A) => Boolean) : Seq[A] Returns the longest suffix of this sequence whose first element does not satisfy the predicate `p`.
`override def` | filter (p : (A) => Boolean) : Seq[A] Returns all the elements of this sequence that satisfy the predicate `p`. The order of the elements is preserved.
`override def` | flatMap [B](f : (A) => Iterable[B]) : Seq[B] Applies the given function `f` to each element of this sequence, then concatenates the results.
`override def` | isDefinedAt (x : Int) : Boolean Is this partial function defined for the index `x`?
`override def` | isEmpty : Boolean Returns true if length == 0
`override def` | lastIndexOf [B >: A](elem : B) : Int Returns the index of the last occurence of the specified element in this sequence, or -1 if the sequence does not contain this element.
`override def` | length : Int Returns the length of the sequence.
`override def` | map [B](f : (A) => B) : Seq[B] Returns the sequence resulting from applying the given function `f` to each element of this sequence.
`override def` | reverse : Seq[A] A sequence consisting of all elements of this sequence in reverse order.
`abstract def` | self : Seq[A]
`override def` | slice (from : Int, len : Int) : Seq[A] Returns a subsequence starting from index `from` consisting of `len` elements.
`override def` | take (n : Int) : Seq[A] Returns a sequence consisting only over the first `n` elements of this sequence, or else the whole sequence, if it has less than `n` elements.
`override def` | takeWhile (p : (A) => Boolean) : Seq[A] Returns the longest prefix of this sequence whose elements satisfy the predicate `p`.
`override def` | toArray [B >: A] : Array[B] Converts this sequence to a fresh Array with `length` elements.

Methods inherited from IterableProxy
elements, foreach, forall, exists, find, findIndexOf, indexOf, foldLeft, foldRight, /:, :\, reduceLeft, reduceRight, sameElements, copyToBuffer, toList, mkString, addString

Methods inherited from Proxy
hashCode, equals, toString

Methods inherited from Seq
size, ++, subseq

Methods inherited from Collection
stringPrefix

Methods inherited from Iterable
mkString, addString, projection, hasDefiniteSize

Methods inherited from PartialFunction
orElse, andThen

Methods inherited from Function1
compose

Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized

Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf

Method Details

`abstract` `def` self : Seq[A]

Overrides
  IterableProxy.self

`override` `def` apply(i : Int) : A

`override` `def` length : Int

  Returns the length of the sequence.

Returns
  the sequence length.

Overrides
  Seq.length

`override` `def` isEmpty : Boolean

  Returns true if length == 0

Overrides
  Seq.isEmpty

@deprecated
`override` `def` concat[B >: A](that : Iterable[B]) : Seq[B]

  Appends two iterable objects.

Returns
  the new iterable object
Deprecated
  use `++` instead

Overrides
  Seq.concat, IterableProxy.concat

`override` `def` isDefinedAt(x : Int) : Boolean

  Is this partial function defined for the index `x`?

Parameters
  `x -` ..
Returns
  `true`, iff `x` is a legal sequence index.

Overrides
  Seq.isDefinedAt

`override` `def` lastIndexOf[B >: A](elem : B) : Int

  Returns the index of the last occurence of the specified element in this sequence, or -1 if the sequence does not contain this element.

Parameters
  `elem -` element to search for.
Returns
  the index in this sequence of the last occurence of the specified element, or -1 if the sequence does not contain this element.

Overrides
  Seq.lastIndexOf

`override` `def` map[B](f : (A) => B) : Seq[B]

  Returns the sequence resulting from applying the given function `f` to each element of this sequence.

Parameters
  `f -` function to apply to each element.
Returns
  `f(a0), ..., f(an)` if this sequence is `a0, ..., an`.

Overrides
  Seq.map, IterableProxy.map

`override` `def` flatMap[B](f : (A) => Iterable[B]) : Seq[B]

  Applies the given function `f` to each element of this sequence, then concatenates the results.

Parameters
  `f -` the function to apply on each element.
Returns
  `f(a0) ::: ... ::: f(an)` if this sequence is `a0, ..., an`.

Overrides
  Seq.flatMap, IterableProxy.flatMap

`override` `def` filter(p : (A) => Boolean) : Seq[A]

  Returns all the elements of this sequence that satisfy the predicate `p`. The order of the elements is preserved.

Parameters
  `p -` the predicate used to filter the list.
Returns
  the elements of this list satisfying `p`.

Overrides
  Seq.filter, IterableProxy.filter

`override` `def` take(n : Int) : Seq[A]

  Returns a sequence consisting only over the first `n` elements of this sequence, or else the whole sequence, if it has less than `n` elements.

Parameters
  `n -` the number of elements to take
Returns
  the new sequence

Overrides
  Seq.take, IterableProxy.take

`override` `def` drop(n : Int) : Seq[A]

  Returns this sequence without its `n` first elements If this sequence has less than `n` elements, the empty sequence is returned.

Parameters
  `n -` the number of elements to drop
Returns
  the new sequence

Overrides
  Seq.drop, IterableProxy.drop

`override` `def` takeWhile(p : (A) => Boolean) : Seq[A]

  Returns the longest prefix of this sequence whose elements satisfy the predicate `p`.

Parameters
  `p -` the test predicate.
Returns
  the longest prefix of this sequence whose elements satisfy the predicate `p`.

Overrides
  Seq.takeWhile, IterableProxy.takeWhile

`override` `def` dropWhile(p : (A) => Boolean) : Seq[A]

  Returns the longest suffix of this sequence whose first element does not satisfy the predicate `p`.

Parameters
  `p -` the test predicate.
Returns
  the longest suffix of the sequence whose first element does not satisfy the predicate `p`.

Overrides
  Seq.dropWhile, IterableProxy.dropWhile

`override` `def` reverse : Seq[A]

  A sequence consisting of all elements of this sequence in reverse order.

Overrides
  Seq.reverse

`override` `def` contains(elem : Any) : Boolean

  Tests if the given value `elem` is a member of this sequence.

Parameters
  `elem -` element whose membership has to be tested.
Returns
  `true` iff there is an element of this sequence which is equal (w.r.t. `==`) to `elem`.

Overrides
  Seq.contains

`override` `def` slice(from : Int, len : Int) : Seq[A]

  Returns a subsequence starting from index `from` consisting of `len` elements.

Parameters
  `from -` ..
  `len -` ..
Returns
  ..

Overrides
  Seq.slice

`override` `def` toArray[B >: A] : Array[B]

  Converts this sequence to a fresh Array with `length` elements.

Overrides
  Seq.toArray

`override` `def` copyToArray[B >: A](xs : Array[B], start : Int) : Unit

  Fills the given array `xs` with the elements of this sequence starting at position `start`.

Notes
  Will not terminate for infinite-sized collections.
Parameters
  `xs -` the array to fill.
  `start -` starting index.
Precondition
  the array must be large enough to hold all elements.