Skip to content

Commit 71eb4a0

Browse files
committed
Move example doc
1 parent ad91afc commit 71eb4a0

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

library/src/scala/collection/IterableOnce.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
435435
* @return a $coll containing the elements greater than or equal to
436436
* index `from` extending up to (but not including) index `until`
437437
* of this $coll.
438+
* @example
439+
* `List('a', 'b', 'c', 'd', 'e').slice(1, 3) == List('b', 'c')`
438440
*/
439441
def slice(from: Int, until: Int): C
440442

@@ -1241,7 +1243,7 @@ trait IterableOnceOps[+A, +CC[_], +C] extends Any { this: IterableOnce[A] =>
12411243
* @param pf the partial function
12421244
* @return an option value containing pf applied to the first
12431245
* value for which it is defined, or `None` if none exists.
1244-
* @example `Seq("a", 1, 5L).collectFirst({ case x: Int => x*10 }) = Some(10)`
1246+
* @example `Seq("a", 1, 5L).collectFirst { case x: Int => x*10 } = Some(10)`
12451247
*/
12461248
def collectFirst[B](pf: PartialFunction[A, B]): Option[B] = {
12471249
// Presumably the fastest way to get in and out of a partial function is for a sentinel function to return itself

library/src/scala/collection/immutable/List.scala

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -186,17 +186,6 @@ sealed abstract class List[+A]
186186
h
187187
}
188188

189-
/** @inheritdoc
190-
*
191-
* @example {{{
192-
* // Given a list
193-
* val letters = List('a','b','c','d','e')
194-
*
195-
* // `slice` returns all elements beginning at index `from` and afterwards,
196-
* // up until index `until` (excluding index `until`.)
197-
* letters.slice(1,3) // Returns List('b','c')
198-
* }}}
199-
*/
200189
override def slice(from: Int, until: Int): List[A] = {
201190
val lo = scala.math.max(from, 0)
202191
if (until <= lo || isEmpty) Nil

0 commit comments

Comments
 (0)