diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-14 15:27:54 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-14 15:27:54 -0800 |
commit | 43d346a1b4b027121116d6e9ccf0b9125eeb4209 (patch) | |
tree | 06d74b5e06852be3fcbfff5f6595203c87b1fadd | |
parent | f32463f0ba199778d369de603be1e890863f4d4d (diff) | |
parent | 0f237e90285a635855a7b093bd997ca2f2a4ccd1 (diff) | |
download | scala-43d346a1b4b027121116d6e9ccf0b9125eeb4209.tar.gz scala-43d346a1b4b027121116d6e9ccf0b9125eeb4209.tar.bz2 scala-43d346a1b4b027121116d6e9ccf0b9125eeb4209.zip |
Merge pull request #1860 from heathermiller/issue/6930
SI-6930 adds documentation to reduceLeft in TraversableOnce
-rw-r--r-- | src/library/scala/collection/TraversableOnce.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/library/scala/collection/TraversableOnce.scala b/src/library/scala/collection/TraversableOnce.scala index d53d000e90..a448ac2c09 100644 --- a/src/library/scala/collection/TraversableOnce.scala +++ b/src/library/scala/collection/TraversableOnce.scala @@ -148,6 +148,20 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] { def foldRight[B](z: B)(op: (A, B) => B): B = reversed.foldLeft(z)((x, y) => op(y, x)) + /** Applies a binary operator to all elements of this $coll, + * going left to right. + * $willNotTerminateInf + * $orderDependentFold + * + * @param op the binary operator. + * @tparam B the result type of the binary operator. + * @return the result of inserting `op` between consecutive elements of this $coll, + * going left to right: + * {{{ + * op( op( ... op(x_1, x_2) ..., x_{n-1}), x_n) + * }}} + * where `x,,1,,, ..., x,,n,,` are the elements of this $coll. + * @throws `UnsupportedOperationException` if this $coll is empty. */ def reduceLeft[B >: A](op: (B, A) => B): B = { if (isEmpty) throw new UnsupportedOperationException("empty.reduceLeft") |