scala.collection.generic

trait SeqForwarder

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

trait SeqForwarder[+A]
extends Seq[A] with IterableForwarder[A]
This class implements a forwarder for sequences. It forwards all calls to a different sequence object except for - toString, hashCode, equals, stringPrefix - newBuilder, view, toSeq - all calls creating a new sequence of the same kind The above methods are forwarded by subclass SeqProxy
Author
Martin Odersky
Version
2.8
Since
2.8
Direct Known Subclasses:
ListBuffer

Method Summary
override def apply (i : 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 endsWith [B](that : Seq[B]) : Boolean
override def indexOf [B >: A](elem : B, from : Int) : Int
Returns the index of the first occurence of the specified object in this sequence, starting from a start index, or -1, if none exists.
override def indexOfSeq [B >: A](that : Seq[B]) : Int
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
The range of all indices of this sequence.
override def isDefinedAt (x : Int) : Boolean
Is this partial function defined for the index x?
override def length : Int
Returns the length of the sequence.
override def lengthCompare (l : 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 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 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 startsWith [B](that : Seq[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.
protected override abstract def underlying : Seq[A]
The iterable object to which calls are forwarded
Methods inherited from IterableForwarder
iterator, sameElements
Methods inherited from TraversableForwarder
isEmpty, nonEmpty, hasDefiniteSize, foreach, forall, exists, count, find, foldLeft, foldRight, reduceLeft, reduceRight, reduceLeftOption, reduceRightOption, copyToBuffer, copyToArray, toArray, toList, toSeq, toStream, mkString, addString, head, last, lastOption
Methods inherited from Seq
companion
Methods inherited from SeqLike
thisCollection, toCollection, size, indexWhere, findIndexOf, indexOf, lastIndexOf, lastIndexOf, lastIndexWhere, lastIndexWhere, reverse, reverseMap, reversedElements, startsWith, indexOfSeq, lastIndexOfSeq, lastIndexOfSeq, union, diff, intersect, removeDuplicates, patch, updated, +:, :+, padTo, sortWith, sortWith, sortBy, view, view, hashCode, equals, toString, findLastIndexOf, equalsWith, containsSlice, projection
Methods inherited from IterableLike
elements, toIterable, take, slice, takeWhile, takeRight, dropRight, zip, zipAll, zipWithIndex, canEqual, first, firstOption
Methods inherited from GenericTraversableTemplate
newBuilder, genericBuilder, unzip, flatten, transpose
Methods inherited from TraversableLike
repr, ++, ++, map, flatMap, filter, filterNot, partialMap, remove, partition, groupBy, /:, :\, sum, product, min, max, headOption, tail, init, drop, dropWhile, span, splitAt, copyToArray, toIndexedSeq, toSet, mkString, mkString, addString, addString, stringPrefix, withFilter
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
protected override abstract def underlying : Seq[A]
The iterable object to which calls are forwarded
Overrides
IterableForwarder.underlying

override def apply(i : Int) : A
Returns the elements at position `idx`

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

override def length : Int
Returns the length of the sequence.

override def lengthCompare(l : 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 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

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

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

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

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

override def startsWith[B](that : Seq[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

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

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

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.

override def indices : Range
The range of all indices of this sequence.