diff options
author | Paul Phillips <paulp@improving.org> | 2010-12-04 07:55:49 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-12-04 07:55:49 +0000 |
commit | 1a45bc7f19a56bd7959a496f617b501d1eae7513 (patch) | |
tree | 0720d9e9b17414ced6c02bbdea147fb18062e5b6 /src/library/scala/collection/IndexedSeqOptimized.scala | |
parent | 9e9914e109c91cd4f86802129c236827517d8386 (diff) | |
download | scala-1a45bc7f19a56bd7959a496f617b501d1eae7513.tar.gz scala-1a45bc7f19a56bd7959a496f617b501d1eae7513.tar.bz2 scala-1a45bc7f19a56bd7959a496f617b501d1eae7513.zip |
A selection of collections additions from the l...
A selection of collections additions from the lower end of the
controversy scale.
// TraversableOnce
def collectFirst[B](pf: PartialFunction[A, B]): Option[B]
def maxBy[B](f: A => B)(implicit cmp: Ordering[B]): A
def minBy[B](f: A => B)(implicit cmp: Ordering[B]): A
// Iterator
def span(p: A => Boolean): (Iterator[A], Iterator[A])
// Traversable
def inits: Iterator[Repr]
def tails: Iterator[Repr]
def unzip3[A1, A2, A3](implicit asTriple: A => (A1, A2, A3)): (CC[A1], CC[A2], CC[A3])
// Sequences
def permutations: Iterator[Repr]
Review by odersky.
Diffstat (limited to 'src/library/scala/collection/IndexedSeqOptimized.scala')
-rwxr-xr-x | src/library/scala/collection/IndexedSeqOptimized.scala | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/src/library/scala/collection/IndexedSeqOptimized.scala b/src/library/scala/collection/IndexedSeqOptimized.scala index 6360de33f1..218ca55dc6 100755 --- a/src/library/scala/collection/IndexedSeqOptimized.scala +++ b/src/library/scala/collection/IndexedSeqOptimized.scala @@ -45,19 +45,7 @@ trait IndexedSeqOptimized[+A, +Repr] extends IndexedSeqLike[A, Repr] { self => val i = prefixLength(!p(_)) if (i < length) Some(this(i)) else None } -/* - override /*IterableLike*/ - def mapFind[B](f: A => Option[B]): Option[B] = { - var i = 0 - var res: Option[B] = None - val len = length - while (res.isEmpty && i < len) { - res = f(this(i)) - i += 1 - } - res - } -*/ + @tailrec private def foldl[B](start: Int, end: Int, z: B, op: (B, A) => B): B = if (start == end) z |