Skip to content

Commit

Permalink
Merge pull request #8929 from japgolly/topic/optIndexedSeqFolds
Browse files Browse the repository at this point in the history
  • Loading branch information
lrytz committed May 8, 2020
2 parents 97419e9 + a14606d commit f2681d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/library/scala/collection/IndexedSeq.scala
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ trait IndexedSeqOps[+A, +CC[_], +C] extends Any with SeqOps[A, CC, C] { self =>
} else Iterator.empty.next()
}

override def foldRight[B](z: B)(op: (A, B) => B): B = {
val it = reverseIterator
var b = z
while (it.hasNext)
b = op(it.next(), b)
b
}

override def view: IndexedSeqView[A] = new IndexedSeqView.Id[A](this)

@deprecated("Use .view.slice(from, until) instead of .view(from, until)", "2.13.0")
Expand Down

0 comments on commit f2681d4

Please sign in to comment.