summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJanek Bogucki <janekdb@gmail.com>2015-11-22 21:08:20 +0000
committerJanek Bogucki <janekdb@gmail.com>2015-11-22 21:08:20 +0000
commita7924629ca1e37e46016a17f333cd7cc8f8772b6 (patch)
tree56c526ab1c6d79edd67b468a75ba26390fe4392f
parent72b855f978b1d2695ca4a2ae942a537c6a6e8f54 (diff)
downloadscala-a7924629ca1e37e46016a17f333cd7cc8f8772b6.tar.gz
scala-a7924629ca1e37e46016a17f333cd7cc8f8772b6.tar.bz2
scala-a7924629ca1e37e46016a17f333cd7cc8f8772b6.zip
Fix List Scaladoc time & space formatting
The Performance section got sucked into a wormhole and popped up in the example tag. The laws of physics differ in the attributes block resulting in the loss of the line break between the Time and Space paragraphs. Fixed by moving the section out of the example tag.
-rw-r--r--src/library/scala/collection/immutable/List.scala26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala
index 53146bd66d..75ddded6d2 100644
--- a/src/library/scala/collection/immutable/List.scala
+++ b/src/library/scala/collection/immutable/List.scala
@@ -25,6 +25,19 @@ import java.io._
* This class is optimal for last-in-first-out (LIFO), stack-like access patterns. If you need another access
* pattern, for example, random access or FIFO, consider using a collection more suited to this than `List`.
*
+ * ==Performance==
+ * '''Time:''' `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list.
+ * This includes the index-based lookup of elements, `length`, `append` and `reverse`.
+ *
+ * '''Space:''' `List` implements '''structural sharing''' of the tail list. This means that many operations are either
+ * zero- or constant-memory cost.
+ * {{{
+ * val mainList = List(3, 2, 1)
+ * val with4 = 4 :: mainList // re-uses mainList, costs one :: instance
+ * val with42 = 42 :: mainList // also re-uses mainList, cost one :: instance
+ * val shorter = mainList.tail // costs nothing as it uses the same 2::1::Nil instances as mainList
+ * }}}
+ *
* @example {{{
* // Make a list via the companion object factory
* val days = List("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
@@ -41,19 +54,6 @@ import java.io._
* }
* }}}
*
- * ==Performance==
- * '''Time:''' `List` has `O(1)` prepend and head/tail access. Most other operations are `O(n)` on the number of elements in the list.
- * This includes the index-based lookup of elements, `length`, `append` and `reverse`.
- *
- * '''Space:''' `List` implements '''structural sharing''' of the tail list. This means that many operations are either
- * zero- or constant-memory cost.
- * {{{
- * val mainList = List(3, 2, 1)
- * val with4 = 4 :: mainList // re-uses mainList, costs one :: instance
- * val with42 = 42 :: mainList // also re-uses mainList, cost one :: instance
- * val shorter = mainList.tail // costs nothing as it uses the same 2::1::Nil instances as mainList
- * }}}
- *
* @note The functional list is characterized by persistence and structural sharing, thus offering considerable
* performance and space consumption benefits in some scenarios if used correctly.
* However, note that objects having multiple references into the same functional list (that is,