scala.collection.generic

trait SequenceProxyTemplate

[source: scala/collection/generic/SequenceProxyTemplate.scala]

trait SequenceProxyTemplate[+A, +This <: SequenceTemplate[A, This] with Sequence[A]]
extends SequenceTemplate[A, This] with IterableProxyTemplate[A, This]
This trait implements a proxy for sequences. It forwards all calls to a different sequence.
Author
Martin Odersky
Version
2.8
Direct Known Subclasses:
SequenceProxy

Method Summary
override def apply (idx : Int) : A
Returns the elements at position `idx`
override def contains (elem : Any) : Boolean
Tests if the given value elem is a member of this sequence.
override def containsSlice [B](that : Sequence[B]) : Boolean
Is that a slice in this?
override def diff [B >: A, That](that : Sequence[B]) : This
override def endsWith [B](that : Sequence[B]) : Boolean
override def equalsWith [B](that : Sequence[B])(f : (A, B) => Boolean) : Boolean
override def findIndexOf (p : (A) => Boolean) : Int
Returns index of the first element satisying a predicate, or -1.
override def findLastIndexOf (p : (A) => Boolean) : Int
Returns index of the last element satisying a predicate, or -1.
override def indexOf [B >: A](elem : B, from : Int) : Int
Returns the index of the first occurence of the specified object in this iterable object, starting from a start index, or -1, if none exists.
override def indexOf [B >: A](elem : B) : Int
Returns the index of the first occurence of the specified object in this iterable object.
override def indexOfSeq [B >: A](that : Sequence[B]) : Int
override def indexWhere (p : (A) => Boolean) : Int
Returns index of the first element satisfying a predicate, or -1, if none exists.
override def indexWhere (p : (A) => Boolean, from : Int) : Int
Returns index of the first element starting from a start index satisying a predicate, or -1, if none exists.
override def indices : Range
override def intersect [B >: A, That](that : Sequence[B]) : This
override def isDefinedAt (x : Int) : Boolean
Is this partial function defined for the index x?
override def lastIndexOf [B >: A](elem : B, end : Int) : Int
Returns the index of the last occurence of the specified element in this sequence before or at a given end index, or -1 if the sequence does not contain this element.
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 lastIndexWhere (p : (A) => Boolean) : Int
Returns index of the last element satisying a predicate, or -1, if none exists.
override def lastIndexWhere (p : (A) => Boolean, end : Int) : Int
Returns index of the last element not exceeding a given end index and satisying a predicate, or -1 if none exists.
override def length : Int
Returns the length of the sequence.
override def lengthCompare (len : Int) : Int
Result of comparing length with operand len. returns x where x < 0 iff this.length < len x == 0 iff this.length == len x > 0 iff this.length > len. The method as implemented here does not call length directly; its running time is O(length min len) instead of O(length). The method should be overwritten if computing length is cheap.
override def padTo [B >: A, That](len : Int, elem : B)(implicit bf : BuilderFactory[B, That, This]) : That
Returns a new sequence of given length containing the elements of this sequence followed by zero or more occurrences of given elements.
override def patch [B >: A, That](from : Int, patch : Sequence[B], replaced : Int)(implicit bf : BuilderFactory[B, That, This]) : That
A new sequence, consisting of all elements of current sequence except that `replaced` elements starting from `from` are replaced by `patch`.
override def prefixLength (p : (A) => Boolean) : Int
Returns length of longest prefix of this seqence such that every element of the prefix satisfies predicate `p`.
override def removeDuplicates : This
Builds a new sequence from this sequence in which any duplicates (wrt to ==) removed. Among duplicate elements, only the first one is retained in the result sequence
override def reverse : This
A sequence of type C consisting of all elements of this sequence in reverse order.
override def reverseIterator : Iterator[A]
The elements of this sequence in reversed order
override def segmentLength (p : (A) => Boolean, from : Int) : Int
Returns length of longest segment starting from a start index `from` such that every element of the segment satisfies predicate `p`.
override def size : Int
Should always be length
override def slice (from : Int) : Sequence[A]
A sub-sequence starting at index from and extending up to the length of the current sequence
override def startsWith [B](that : Sequence[B], offset : Int) : Boolean
Checks whether the argument sequence is contained at the specified index within the receiver object. If the both the receiver object, this and the argument, that are infinite sequences this method may not terminate.
override def startsWith [B](that : Sequence[B]) : Boolean
Check whether the receiver object starts with the argument sequence.
override def union [B >: A, That](that : Sequence[B])(implicit bf : BuilderFactory[B, That, This]) : That
override def view : SequenceView[A, This]
Creates a view of this iterable @see IterableView
override def view (from : Int, until : Int) : SequenceView[A, This]
A sub-iterable view starting at index `from` and extending up to (but not including) index `until`.
override def zip [A1 >: A, B, That](that : Sequence[B])(implicit bf : BuilderFactory[(A1, B), That, This]) : That
Returns an iterable formed from this iterable and another iterable by combining corresponding elements in pairs. If one of the two iterables is longer than the other, its remaining elements are ignored.
override def zipAll [B, A1 >: A, That](that : Sequence[B], thisElem : A1, thatElem : B)(implicit bf : BuilderFactory[(A1, B), That, This]) : That
Returns a iterable formed from this iterable and the specified iterable that by associating each element of the former with the element at the same position in the latter.
override def zipWithIndex [A1 >: A, That](implicit bf : BuilderFactory[(A1, Int), That, This]) : That
Zips this iterable with its indices (startiong from 0).
Methods inherited from IterableProxyTemplate
iterator, foreach, isEmpty, foldRight, reduceRight, toIterable, head, takeRight, dropRight, sameElements, toStream
Methods inherited from TraversableProxyTemplate
self (abstract), nonEmpty, hasDefiniteSize, ++, ++, map, flatMap, filter, filterNot, remove, partition, groupBy, forall, exists, count, find, foldLeft, /:, :\, reduceLeft, reduceLeftOption, reduceRightOption, headOption, tail, last, lastOption, init, take, drop, slice, takeWhile, dropWhile, span, splitAt, copyToBuffer, copyToArray, copyToArray, toArray, toList, toSequence, toSet, mkString, mkString, mkString, addString, addString, addString, stringPrefix
Methods inherited from Proxy
hashCode, equals, toString
Methods inherited from SequenceTemplate
reversedElements, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, sortWith, projection
Methods inherited from IterableTemplate
elements, first, firstOption, toSeq
Methods inherited from TraversableTemplate
newBuilder (abstract), thisCollection, filterMap
Methods inherited from AnyRef
getClass, clone, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
override def length : Int
Returns the length of the sequence.
Returns
the sequence length.
Overrides
SequenceTemplate.length

override def apply(idx : Int) : A
Returns the elements at position `idx`
Overrides
SequenceTemplate.apply

override def lengthCompare(len : Int) : Int
Result of comparing length with operand len. returns x where x < 0 iff this.length < len x == 0 iff this.length == len x > 0 iff this.length > len. The method as implemented here does not call length directly; its running time is O(length min len) instead of O(length). The method should be overwritten if computing length is cheap.
Overrides
SequenceTemplate.lengthCompare

override def size : Int
Should always be length
Overrides
SequenceTemplate.size

override def isDefinedAt(x : Int) : Boolean
Is this partial function defined for the index x?
Overrides
SequenceTemplate.isDefinedAt

override def zip[A1 >: A, B, That](that : Sequence[B])(implicit bf : BuilderFactory[(A1, B), That, This]) : That
Returns an iterable formed from this iterable and another iterable by combining corresponding elements in pairs. If one of the two iterables is longer than the other, its remaining elements are ignored.
Parameters
that - The iterable providing the second half of each result pair
Overrides
SequenceTemplate.zip

override def zipAll[B, A1 >: A, That](that : Sequence[B], thisElem : A1, thatElem : B)(implicit bf : BuilderFactory[(A1, B), That, This]) : That
Returns a iterable formed from this iterable and the specified iterable that by associating each element of the former with the element at the same position in the latter.
Parameters
that - iterable that may have a different length as the self iterable.
thisElem - element thisElem is used to fill up the resulting iterable if the self iterable is shorter than that
thatElem - element thatElem is used to fill up the resulting iterable if that is shorter than the self iterable
Returns
Sequence((a0,b0), ..., (an,bn), (elem,bn+1), ..., {elem,bm}) when [a0, ..., an] zip [b0, ..., bm] is invoked where m > n.
Overrides
SequenceTemplate.zipAll

override def zipWithIndex[A1 >: A, That](implicit bf : BuilderFactory[(A1, Int), That, This]) : That
Zips this iterable with its indices (startiong from 0).
Overrides
SequenceTemplate.zipWithIndex

override def segmentLength(p : (A) => Boolean, from : Int) : Int
Returns length of longest segment starting from a start index `from` such that every element of the segment satisfies predicate `p`.
Notes
may not terminate for infinite-sized collections.
Parameters
p - the predicate
from - the start index
Overrides
SequenceTemplate.segmentLength

override def prefixLength(p : (A) => Boolean) : Int
Returns length of longest prefix of this seqence such that every element of the prefix satisfies predicate `p`.
Notes
may not terminate for infinite-sized collections.
Parameters
p - the predicate
Overrides
SequenceTemplate.prefixLength

override def indexWhere(p : (A) => Boolean) : Int
Returns index of the first element satisfying a predicate, or -1, if none exists.
Notes
may not terminate for infinite-sized collections.
Parameters
p - the predicate
Overrides
SequenceTemplate.indexWhere

override def indexWhere(p : (A) => Boolean, from : Int) : Int
Returns index of the first element starting from a start index satisying a predicate, or -1, if none exists.
Notes
may not terminate for infinite-sized collections.
Parameters
p - the predicate
from - the start index
Overrides
SequenceTemplate.indexWhere

override def findIndexOf(p : (A) => Boolean) : Int
Returns index of the first element satisying a predicate, or -1.
Overrides
SequenceTemplate.findIndexOf

override def indexOf[B >: A](elem : B) : Int
Returns the index of the first occurence of the specified object in this iterable object.
Notes
may not terminate for infinite-sized collections.
Parameters
elem - element to search for.
Returns
the index in this sequence of the first occurence of the specified element, or -1 if the sequence does not contain this element.
Overrides
SequenceTemplate.indexOf

override def indexOf[B >: A](elem : B, from : Int) : Int
Returns the index of the first occurence of the specified object in this iterable object, starting from a start index, or -1, if none exists.
Notes
may not terminate for infinite-sized collections.
Parameters
elem - element to search for.
Overrides
SequenceTemplate.indexOf

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
SequenceTemplate.lastIndexOf

override def lastIndexOf[B >: A](elem : B, end : Int) : Int
Returns the index of the last occurence of the specified element in this sequence before or at a given end index, or -1 if the sequence does not contain this element.
Parameters
elem - element to search for.
end - the end index
Overrides
SequenceTemplate.lastIndexOf

override def lastIndexWhere(p : (A) => Boolean) : Int
Returns index of the last element satisying a predicate, or -1, if none exists.
Parameters
p - the predicate
Returns
the index of the last element satisfying p, or -1 if such an element does not exist
Overrides
SequenceTemplate.lastIndexWhere

override def lastIndexWhere(p : (A) => Boolean, end : Int) : Int
Returns index of the last element not exceeding a given end index and satisying a predicate, or -1 if none exists.
Parameters
end - the end index
p - the predicate
Overrides
SequenceTemplate.lastIndexWhere

override def reverse : This
A sequence of type C consisting of all elements of this sequence in reverse order.
Notes
the operation is implemented by building a new sequence from this(length - 1), ..., this(0) If random access is inefficient for the given sequence implementation, this operation should be overridden.
Overrides
SequenceTemplate.reverse

override def reverseIterator : Iterator[A]
The elements of this sequence in reversed order
Overrides
SequenceTemplate.reverseIterator

override def startsWith[B](that : Sequence[B], offset : Int) : Boolean
Checks whether the argument sequence is contained at the specified index within the receiver object. If the both the receiver object, this and the argument, that are infinite sequences this method may not terminate.
Returns
true if that is contained in this, at the specified index, otherwise false
See Also
String.startsWith
Overrides
SequenceTemplate.startsWith

override def startsWith[B](that : Sequence[B]) : Boolean
Check whether the receiver object starts with the argument sequence.
Returns
true if that is a prefix of this, otherwise false
Overrides
SequenceTemplate.startsWith

override def endsWith[B](that : Sequence[B]) : Boolean
Returns
true if this sequence end with that sequence
See Also
String.endsWith
Overrides
SequenceTemplate.endsWith

override def indexOfSeq[B >: A](that : Sequence[B]) : Int
Returns
-1 if that not contained in this, otherwise the first index where that is contained.
Overrides
SequenceTemplate.indexOfSeq

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
SequenceTemplate.contains

override def union[B >: A, That](that : Sequence[B])(implicit bf : BuilderFactory[B, That, This]) : That

Computes the multiset union of this sequence and the given sequence that. For example:

      val xs = List(1, 1, 2)
      val ys = List(1, 2, 2, 3)
      println(xs union ys)  // prints "List(1, 1, 2, 1, 2, 2, 3)"
      println(ys union xs)  // prints "List(1, 2, 2, 3, 1, 1, 2)"
    
Parameters
that - the sequence of elements to add to the sequence.
Returns
a sequence containing the elements of this sequence and those of the given sequence that.
Overrides
SequenceTemplate.union

override def diff[B >: A, That](that : Sequence[B]) : This

Computes the multiset difference between this sequence and the given sequence that. If an element appears more than once in both sequences, the difference contains m copies of that element, where m is the difference between the number of times the element appears in this sequence and the number of times it appears in that. For example:

      val xs = List(1, 1, 2)
      val ys = List(1, 2, 2, 3)
      println(xs diff ys)  // prints "List(1)"
      println(xs -- ys)    // prints "List()"
    
Parameters
that - the sequence of elements to remove from this sequence.
Returns
the sequence of elements contained only in this sequence plus m copies of each element present in both sequences, where m is defined as above.
Overrides
SequenceTemplate.diff

override def intersect[B >: A, That](that : Sequence[B]) : This

Computes the multiset intersection between this sequence and the given sequence that; the intersection contains m copies of an element contained in both sequences, where m is the smaller of the number of times the element appears in this sequence or in that. For example:

      val xs = List(1, 1, 2)
      val ys = List(3, 2, 2, 1)
      println(xs intersect ys)  // prints "List(1, 2)"
      println(ys intersect xs)  // prints "List(2, 1)"
    
Parameters
that - the sequence to intersect.
Returns
the sequence of elements contained both in this sequence and in the given sequence that.
Overrides
SequenceTemplate.intersect

override def removeDuplicates : This
Builds a new sequence from this sequence in which any duplicates (wrt to ==) removed. Among duplicate elements, only the first one is retained in the result sequence
Overrides
SequenceTemplate.removeDuplicates

override def patch[B >: A, That](from : Int, patch : Sequence[B], replaced : Int)(implicit bf : BuilderFactory[B, That, This]) : That
A new sequence, consisting of all elements of current sequence except that `replaced` elements starting from `from` are replaced by `patch`.
Overrides
SequenceTemplate.patch

override def padTo[B >: A, That](len : Int, elem : B)(implicit bf : BuilderFactory[B, That, This]) : That
Returns a new sequence of given length containing the elements of this sequence followed by zero or more occurrences of given elements.
Overrides
SequenceTemplate.padTo

override def indices : Range
Overrides
SequenceTemplate.indices

override def view : SequenceView[A, This]
Creates a view of this iterable @see IterableView
Overrides
SequenceTemplate.view, IterableProxyTemplate.view

override def view(from : Int, until : Int) : SequenceView[A, This]
A sub-iterable view starting at index `from` and extending up to (but not including) index `until`.
Parameters
from - The index of the first element of the slice
until - The index of the element following the slice
Notes
The difference between `view` and `slice` is that `view` produces a view of the current iterable, whereas `slice` produces a new iterable.
Might return different results for different runs, unless this iterable is ordered
view(from, to) is equivalent to view.slice(from, to)
Overrides
SequenceTemplate.view, IterableProxyTemplate.view

override def findLastIndexOf(p : (A) => Boolean) : Int
Returns index of the last element satisying a predicate, or -1.
Overrides
SequenceTemplate.findLastIndexOf

override def slice(from : Int) : Sequence[A]
A sub-sequence starting at index from and extending up to the length of the current sequence
Parameters
from - The index of the first element of the slice
Throws
IndexOutOfBoundsException - if from < 0
Overrides
SequenceTemplate.slice

override def equalsWith[B](that : Sequence[B])(f : (A, B) => Boolean) : Boolean
Overrides
SequenceTemplate.equalsWith

override def containsSlice[B](that : Sequence[B]) : Boolean
Is that a slice in this?
Overrides
SequenceTemplate.containsSlice