summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHeather Miller <heather.miller@epfl.ch>2012-02-25 13:25:17 +0100
committerHeather Miller <heather.miller@epfl.ch>2012-02-25 13:25:17 +0100
commitac7376ed5306cac06c62213ddf358e26101453b3 (patch)
treed688b6243f1e1e9df3d280ef0d531912bfa49212 /src
parent0c2f493804db6b594d7ec68e49e76c75a316230b (diff)
downloadscala-ac7376ed5306cac06c62213ddf358e26101453b3.tar.gz
scala-ac7376ed5306cac06c62213ddf358e26101453b3.tar.bz2
scala-ac7376ed5306cac06c62213ddf358e26101453b3.zip
Improvement to API docs: GenTraversableLike and List. Fixes SI-5522.
Diffstat (limited to 'src')
-rw-r--r--src/library/scala/collection/GenTraversableLike.scala2
-rw-r--r--src/library/scala/collection/immutable/List.scala10
2 files changed, 11 insertions, 1 deletions
diff --git a/src/library/scala/collection/GenTraversableLike.scala b/src/library/scala/collection/GenTraversableLike.scala
index c837775cf9..1dcc0bdac7 100644
--- a/src/library/scala/collection/GenTraversableLike.scala
+++ b/src/library/scala/collection/GenTraversableLike.scala
@@ -318,7 +318,7 @@ trait GenTraversableLike[+A, +Repr] extends GenTraversableOnce[A] with Paralleli
* $orderDependent
*
* @param from the lowest index to include from this $coll.
- * @param until the highest index to EXCLUDE from this $coll.
+ * @param until the lowest index to EXCLUDE from this $coll.
* @return a $coll containing the elements greater than or equal to
* index `from` extending up to (but not including) index `until`
* of this $coll.
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index 5f3f9b717f..e2a4a09938 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -205,6 +205,16 @@ sealed abstract class List[+A] extends AbstractSeq[A]
these
}
+ /**
+ * @example {{{
+ * // Given a list
+ * val letters = List('a','b','c','d','e')
+ *
+ * // `slice` returns all elements beginning at index `from` and afterwards,
+ * // up until index `until` (excluding index `until`.)
+ * letters.slice(1,3) // Returns List('b','c')
+ * }}}
+ */
override def slice(from: Int, until: Int): List[A] = {
val lo = math.max(from, 0)
if (until <= lo || isEmpty) Nil