From 69a43cc613f34f429008324035c1564535dfc05f Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Mon, 1 Jun 2020 15:31:46 +0200 Subject: [PATCH 1/9] Added list creation and unit tests --- .../com/baeldung/collections/ListExample.kt | 13 +++++++++++++ .../collections/ListExampleUnitTest.kt | 18 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt create mode 100644 core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt new file mode 100644 index 0000000000..a0dd04a760 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt @@ -0,0 +1,13 @@ +package com.baeldung.collections + +import kotlin.collections.List + +class ListExample { + fun createList(): List { + return listOf("one", "two", "three") + } + + fun createMutableList(): MutableList { + return mutableListOf("Berlin", "Kolkata", "London") + } +} \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt new file mode 100644 index 0000000000..46e4d09369 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt @@ -0,0 +1,18 @@ +package com.baeldung.collections + +import org.junit.jupiter.api.Test +import org.junit.jupiter.api.Assertions.assertEquals +import org.junit.jupiter.api.Assertions.assertNotEquals +import kotlin.test.assertTrue + +class ListExampleUnitTest { + + private val classUnderTest: ListExample = ListExample() + + @Test + fun whenListIsCreated_thenContainsElements() { + assertTrue(classUnderTest.createList().contains("two")) + assertTrue(classUnderTest.createMutableList().contains("Berlin")) + } + +} \ No newline at end of file From ba924ce978c9ea3ed82677ebd8fd497f3c4f90fe Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Tue, 2 Jun 2020 02:14:23 +0200 Subject: [PATCH 2/9] Added functions for iterating and retrieving elements --- .../com/baeldung/collections/ListExample.kt | 79 ++++++++++++++++++- .../collections/ListExampleUnitTest.kt | 19 ++++- 2 files changed, 94 insertions(+), 4 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt index a0dd04a760..8b8028f613 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt @@ -3,11 +3,86 @@ package com.baeldung.collections import kotlin.collections.List class ListExample { + + private val countries = listOf("Germany", "India", "Japan", "Brazil", "Australia") + private val cities = mutableListOf("Berlin", "Calcutta", "Seoul", "Sao Paulo", "Sydney") + fun createList(): List { - return listOf("one", "two", "three") + val countryList = listOf("Germany", "India", "Japan", "Brazil") + return countryList } fun createMutableList(): MutableList { - return mutableListOf("Berlin", "Kolkata", "London") + val cityList = mutableListOf("Berlin", "Calcutta", "Seoul", "Sao Paulo") + return cityList } + + fun iterateUsingForLoop() { + countries.forEach { it -> print("$it ") } + println() + + for (country in countries) { + print("$country ") + } + println() + + for (i in 0 until countries.size) { + print("${countries[i]} ") + } + println() + + countries.forEachIndexed { i, e -> + println("country[$i] = $e") + } + } + + fun iterateUsingListIterator() { + val iterator = countries.listIterator() + while (iterator.hasNext()) { + val country = iterator.next() + print("$country ") + } + println() + + while (iterator.hasPrevious()) { + println("Index: ${iterator.previousIndex()}") + } + } + + fun iterateUsingIterator() { + val iterator = cities.iterator() + iterator.next() + iterator.remove() + println(cities) + } + + fun iterateUsingMutableListIterator() { + val iterator = cities.listIterator(1) + iterator.next() + iterator.add("London") + iterator.next() + iterator.set("Milan") + println(cities) + } + + fun retrieveElementsInList(): String { + println(countries[2]) + return countries[2] + } + + fun retrieveElementsUsingGet(): String { + println(countries.get(3)) + return countries.get(3) + } + + fun retrieveElementsFirstAndLast(): String? { + println(countries.first()) + println(countries.last()) + println(countries.first { it.length > 7 }) + println(countries.last { it.startsWith("J") }) + println(countries.firstOrNull { it.length > 8 }) + return countries.firstOrNull { it.length > 8 } + } + + //5. Retrieve parts of the list } \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt index 46e4d09369..f4a7be0ec0 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt @@ -3,6 +3,7 @@ package com.baeldung.collections import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals +import kotlin.test.assertNull import kotlin.test.assertTrue class ListExampleUnitTest { @@ -11,8 +12,22 @@ class ListExampleUnitTest { @Test fun whenListIsCreated_thenContainsElements() { - assertTrue(classUnderTest.createList().contains("two")) - assertTrue(classUnderTest.createMutableList().contains("Berlin")) + assertTrue(classUnderTest.createList().contains("India")) + assertTrue(classUnderTest.createMutableList().contains("Seoul")) } + @Test + fun whenRetrieveElementsInList_thenSuccess() { + assertEquals("Japan", classUnderTest.retrieveElementsInList()) + } + + @Test + fun whenRetrieveElementsUsingGet_thenSuccess() { + assertEquals("Brazil", classUnderTest.retrieveElementsUsingGet()) + } + + @Test + fun whenRetrieveElementsFirstAndLast_thenSuccess() { + assertEquals("Australia", classUnderTest.retrieveElementsFirstAndLast()) + } } \ No newline at end of file From db695999982446070b4cd0b10c9159358be2920b Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Thu, 4 Jun 2020 18:07:25 +0200 Subject: [PATCH 3/9] Added functions for list write and sort operations --- .../com/baeldung/collections/ListExample.kt | 96 ++++++++++++++++++- .../collections/ListExampleUnitTest.kt | 75 +++++++++++++++ 2 files changed, 170 insertions(+), 1 deletion(-) diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt index 8b8028f613..38391a1049 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt @@ -84,5 +84,99 @@ class ListExample { return countries.firstOrNull { it.length > 8 } } - //5. Retrieve parts of the list + fun retrieveSubList(): List { + val subList = countries.subList(1, 4) + println(subList) + return subList + } + + fun retrieveListSliceUsingIndices(): List { + val sliceList = countries.slice(1..4) + println(sliceList) + return sliceList + } + + fun retrieveListSliceUsingIndicesList(): List { + val sliceList = countries.slice(listOf(1, 4)) + println(sliceList) + return sliceList + } + + fun countList(): Int { + val count = countries.count() + println(count) + return count + } + + fun countListUsingPredicate(): Int { + val count = countries.count { it.length > 5 } + println(count) + return count + } + + fun countListUsingProperty(): Int { + val size = countries.size + println(size) + return size + } + + fun addToList(): List { + cities.add("Barcelona") + println(cities) + cities.add(3, "London") + println(cities) + cities.addAll(listOf("Singapore", "Moscow")) + println(cities) + cities.addAll(2, listOf("Prague", "Amsterdam")) + println(cities) + return cities + } + + fun removeFromList(): List { + cities.remove("Seoul") + println(cities) + cities.removeAt(1) + println(cities) + return cities + } + + fun replaceFromList(): List { + cities.set(3, "Prague") + println(cities) + cities[4] = "Moscow" + println(cities) + cities.fill("Barcelona") + println(cities) + return cities + } + + fun sortMutableList(): List { + cities.sort() + println(cities) + cities.sortDescending() + println(cities) + return cities + } + + fun sortList(): List { + val sortedCountries = countries.sorted() + println("countries = $countries") + println("sortedCountries = $sortedCountries") + val sortedCountriesDescending = countries.sortedDescending() + println("countries = $countries") + println("sortedCountriesDescending = $sortedCountriesDescending") + return sortedCountriesDescending + } + + fun checkOneElementInList(): Boolean { + return countries.contains("Germany") + } + + fun checkOneElementInListUsingOperator(): Boolean { + return "Spain" in countries + } + + fun checkElementsInList(): Boolean { + return cities.containsAll(listOf("Calcutta", "Sao Paulo", "Sydney")) + } } \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt index f4a7be0ec0..541c5fd64f 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt @@ -3,6 +3,7 @@ package com.baeldung.collections import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.assertEquals import org.junit.jupiter.api.Assertions.assertNotEquals +import kotlin.test.assertFalse import kotlin.test.assertNull import kotlin.test.assertTrue @@ -30,4 +31,78 @@ class ListExampleUnitTest { fun whenRetrieveElementsFirstAndLast_thenSuccess() { assertEquals("Australia", classUnderTest.retrieveElementsFirstAndLast()) } + + @Test + fun whenRetrieveSubList_thenSuccess() { + assertEquals(3, classUnderTest.retrieveSubList().size) + } + + @Test + fun whenRetrieveListSliceUsingIndices_thenSuccess() { + assertEquals(4, classUnderTest.retrieveListSliceUsingIndices().size) + } + + @Test + fun whenRetrieveListSliceUsingIndicesList_thenSuccess() { + assertEquals(2, classUnderTest.retrieveListSliceUsingIndicesList().size) + } + + @Test + fun whenCountList_thenSuccess() { + assertEquals(5, classUnderTest.countList()) + } + + @Test + fun whenCountListUsingPredicate_thenSuccess() { + assertEquals(3, classUnderTest.countListUsingPredicate()) + } + + @Test + fun whenCountListUsingProperty_thenSuccess() { + assertEquals(5, classUnderTest.countListUsingProperty()) + } + + @Test + fun whenAddToList_thenSuccess() { + assertEquals(11, classUnderTest.addToList().count()) + } + + @Test + fun whenRemoveFromList_thenSuccess() { + val list = classUnderTest.removeFromList() + assertEquals(3, list.size) + assertEquals("Sao Paulo", list[1]) + } + + @Test + fun whenReplaceFromList_thenSuccess() { + val list = classUnderTest.replaceFromList() + assertEquals(5, list.size) + assertEquals("Barcelona", list[1]) + } + + @Test + fun whenSortMutableList_thenSuccess() { + assertEquals("Sydney", classUnderTest.sortMutableList()[0]) + } + + @Test + fun whenSortList_thenSuccess() { + assertEquals("India", classUnderTest.sortList()[1]) + } + + @Test + fun whenCheckOneElementInList_thenSuccess() { + assertTrue(classUnderTest.checkOneElementInList()) + } + + @Test + fun whenCheckOneElementInListUsingOperator_thenSuccess() { + assertFalse(classUnderTest.checkOneElementInListUsingOperator()) + } + + @Test + fun whenCheckElementsInList_thenSuccess() { + assertTrue(classUnderTest.checkElementsInList()) + } } \ No newline at end of file From aabef622a805378334a14372d1446f86453158ea Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Fri, 5 Jun 2020 00:39:17 +0200 Subject: [PATCH 4/9] Updated README.md with the article links --- core-kotlin-modules/core-kotlin-collections/README.md | 1 + core-kotlin-modules/core-kotlin-lang-2/README.md | 1 + 2 files changed, 2 insertions(+) diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md index f0da2b4cfd..8eb0eea269 100644 --- a/core-kotlin-modules/core-kotlin-collections/README.md +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -9,3 +9,4 @@ This module contains articles about core Kotlin collections. - [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) - [Collection Transformations in Kotlin](https://www.baeldung.com/kotlin-collection-transformations) +- [Working with lists in Kotlin](https://www.baeldung.com/working-with-lists-in-kotlin) \ No newline at end of file diff --git a/core-kotlin-modules/core-kotlin-lang-2/README.md b/core-kotlin-modules/core-kotlin-lang-2/README.md index e64a39cb9b..9af68a3428 100644 --- a/core-kotlin-modules/core-kotlin-lang-2/README.md +++ b/core-kotlin-modules/core-kotlin-lang-2/README.md @@ -10,4 +10,5 @@ This module contains articles about core features in the Kotlin language. - [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array) - [Lazy Initialization in Kotlin](https://www.baeldung.com/kotlin-lazy-initialization) - [Comprehensive Guide to Null Safety in Kotlin](https://www.baeldung.com/kotlin-null-safety) +- [If-Else Expression in Kotlin](https://www.baeldung.com/kotlin/if-else-expression) - [[<-- Prev]](/core-kotlin-modules/core-kotlin-lang) From 79838324c4a119b50e50b910a5625eb8fd5663e5 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Wed, 10 Jun 2020 14:54:54 +0200 Subject: [PATCH 5/9] Removed the article link from README.md --- core-kotlin-modules/core-kotlin-collections/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md index 38f13de6b8..c563efb9eb 100644 --- a/core-kotlin-modules/core-kotlin-collections/README.md +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -9,5 +9,4 @@ This module contains articles about core Kotlin collections. - [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) - [Collection Transformations in Kotlin](https://www.baeldung.com/kotlin-collection-transformations) -- [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) -- [Working with lists in Kotlin](https://www.baeldung.com/working-with-lists-in-kotlin) +- [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) \ No newline at end of file From 71262e5e55c14ceac6d0bd820982cef481c8c425 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Fri, 12 Jun 2020 23:20:17 +0200 Subject: [PATCH 6/9] Refactored the for loop implementation --- .../com/baeldung/collections/ListExample.kt | 32 ++++++++++++++++--- .../collections/ListExampleUnitTest.kt | 20 ++++++++++++ 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt index 38391a1049..10450cf84f 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt @@ -17,23 +17,45 @@ class ListExample { return cityList } - fun iterateUsingForLoop() { - countries.forEach { it -> print("$it ") } - println() + fun iterateUsingForEachLoop(): List { + val countryLength = mutableListOf() + countries.forEach { it -> + print("$it ") + println(" Length: ${it.length}") + countryLength.add(it.length) + } + return countryLength + } + fun iterateUsingForLoop(): List { + val countryLength = mutableListOf() for (country in countries) { print("$country ") + println(" Length: ${country.length}") + countryLength.add(country.length) } - println() + return countryLength + } + fun iterateUsingForLoopRange(): List { + val countryLength = mutableListOf() for (i in 0 until countries.size) { print("${countries[i]} ") + println(" Length: ${countries[i].length}") + countryLength.add(countries[i].length) } - println() + return countryLength + } + fun iterateUsingForEachIndexedLoop(): List { + val countryLength = mutableListOf() countries.forEachIndexed { i, e -> println("country[$i] = $e") + print(" Index: $i") + println(" Length: ${e.length}") + countryLength.add(e.length) } + return countryLength } fun iterateUsingListIterator() { diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt index 541c5fd64f..195a0cf52a 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt @@ -17,6 +17,26 @@ class ListExampleUnitTest { assertTrue(classUnderTest.createMutableList().contains("Seoul")) } + @Test + fun whenIterateUsingForEachLoop_thenSuccess() { + assertEquals(7, classUnderTest.iterateUsingForEachLoop()[0]) + } + + @Test + fun whenIterateUsingForLoop_thenSuccess() { + assertEquals(5, classUnderTest.iterateUsingForLoop()[1]) + } + + @Test + fun whenIterateUsingForLoopRange_thenSuccess() { + assertEquals(6, classUnderTest.iterateUsingForLoopRange()[3]) + } + + @Test + fun whenIterateUsingForEachIndexedLoop_thenSuccess() { + assertEquals(9, classUnderTest.iterateUsingForEachIndexedLoop()[4]) + } + @Test fun whenRetrieveElementsInList_thenSuccess() { assertEquals("Japan", classUnderTest.retrieveElementsInList()) From 32bcd87996fa9a114ccf888864d5296ac0c04b33 Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Wed, 17 Jun 2020 00:28:15 +0200 Subject: [PATCH 7/9] Renamed package --- .../com/baeldung/{ => kotlin}/collections/ListExample.kt | 2 +- .../baeldung/{ => kotlin}/collections/ListExampleUnitTest.kt | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) rename core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/{ => kotlin}/collections/ListExample.kt (99%) rename core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/{ => kotlin}/collections/ListExampleUnitTest.kt (96%) diff --git a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/ListExample.kt similarity index 99% rename from core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt rename to core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/ListExample.kt index 10450cf84f..a29eabe623 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/collections/ListExample.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/main/kotlin/com/baeldung/kotlin/collections/ListExample.kt @@ -1,4 +1,4 @@ -package com.baeldung.collections +package com.baeldung.kotlin.collections import kotlin.collections.List diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/ListExampleUnitTest.kt similarity index 96% rename from core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/ListExampleUnitTest.kt index 195a0cf52a..71fe3bf1e0 100644 --- a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/ListExampleUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/kotlin/collections/ListExampleUnitTest.kt @@ -1,10 +1,8 @@ -package com.baeldung.collections +package com.baeldung.kotlin.collections import org.junit.jupiter.api.Test import org.junit.jupiter.api.Assertions.assertEquals -import org.junit.jupiter.api.Assertions.assertNotEquals import kotlin.test.assertFalse -import kotlin.test.assertNull import kotlin.test.assertTrue class ListExampleUnitTest { From 869bc67e93ad0bbc7a4031f4b61af889efe195bb Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Sat, 20 Jun 2020 13:31:10 +0200 Subject: [PATCH 8/9] Removed links --- core-kotlin-modules/core-kotlin-collections/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md index 7dc63e27e8..c563efb9eb 100644 --- a/core-kotlin-modules/core-kotlin-collections/README.md +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -9,5 +9,4 @@ This module contains articles about core Kotlin collections. - [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) - [Collection Transformations in Kotlin](https://www.baeldung.com/kotlin-collection-transformations) -- [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) -- [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) \ No newline at end of file +- [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) \ No newline at end of file From 4e6e3850ac20f6867d0daa48f4c4f2b2fc87023f Mon Sep 17 00:00:00 2001 From: Anirban Chatterjee Date: Sat, 20 Jun 2020 14:08:17 +0200 Subject: [PATCH 9/9] Updated README.md --- core-kotlin-modules/core-kotlin-collections/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md index c563efb9eb..997680c2bc 100644 --- a/core-kotlin-modules/core-kotlin-collections/README.md +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -9,4 +9,5 @@ This module contains articles about core Kotlin collections. - [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) - [Collection Transformations in Kotlin](https://www.baeldung.com/kotlin-collection-transformations) -- [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) \ No newline at end of file +- [Difference between fold and reduce in Kotlin](https://www.baeldung.com/kotlin/fold-vs-reduce) +- [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort)