From 2eb805e47505388c0e47102e9257f6f79681e699 Mon Sep 17 00:00:00 2001 From: Simon Ogorodnik Date: Thu, 9 Mar 2017 17:47:09 +0300 Subject: Create HTML based format for kotlin-website --- .../format/website-html/newLinesInSamples.html | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 core/testdata/format/website-html/newLinesInSamples.html (limited to 'core/testdata/format/website-html/newLinesInSamples.html') diff --git a/core/testdata/format/website-html/newLinesInSamples.html b/core/testdata/format/website-html/newLinesInSamples.html new file mode 100644 index 00000000..0babe122 --- /dev/null +++ b/core/testdata/format/website-html/newLinesInSamples.html @@ -0,0 +1,19 @@ +
test / foo
+

foo

+ +
fun foo(): Unit
+

+
+fun main(args: Array) {
+//sampleStart
+val words = listOf("a", "abc", "ab", "def", "abcd")
+val byLength = words.groupBy { it.length }
+
+println(byLength.keys) // [1, 3, 2, 4]
+println(byLength.values) // [[a], [abc, def], [ab], [abcd]]
+
+val mutableByLength: MutableMap<Int, MutableList<String>> = words.groupByTo(mutableMapOf()) { it.length }
+// same content as in byLength map, but the map is mutable
+println("mutableByLength == byLength is ${mutableByLength == byLength}") // true
+//sampleEnd
+}
-- cgit