File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
src/main/scala/scalatutorial/sections Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,14 @@ object StandardLibrary extends ScalaTutorialSection {
2424 *
2525 * - Lists are immutable --- the elements of a list cannot be changed,
2626 * - Lists are recursive (as you will see in the next subsection),
27- * - Lists are ''homogeneous'': the elements of a list must all have the
28- * same type.
27+ * - Lists are ''homogeneous'': A list is intended to be composed of elements that all have the same type.
28+ *
29+ * That's because when you create a `List` of elements with different types it will look for a common ancestor.
30+ * The common ancestor for all types is `Any`
31+ *
32+ * {{{
33+ * val heterogeneousList: List[Any] = List(1, "1", '1')
34+ * }}}
2935 *
3036 * The type of a list with elements of type `T` is written `List[T]`:
3137 *
You can’t perform that action at this time.
0 commit comments