diff --git a/core-kotlin-2/README.md b/core-kotlin-2/README.md index 89e30bc5fe..544c0b57ec 100644 --- a/core-kotlin-2/README.md +++ b/core-kotlin-2/README.md @@ -5,7 +5,4 @@ This module contains articles about core Kotlin. ### Relevant articles: - [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions) -- [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) -- [Split a List into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) -- [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) - More articles: [[<-- prev]](/core-kotlin) diff --git a/core-kotlin-modules/core-kotlin-advanced/README.md b/core-kotlin-modules/core-kotlin-advanced/README.md new file mode 100644 index 0000000000..2e99e3b078 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-advanced/README.md @@ -0,0 +1,11 @@ +## Core Kotlin Advanced + +This module contains articles about advanced topics in Kotlin. + +### Relevant articles: +- [Building DSLs in Kotlin](https://www.baeldung.com/kotlin-dsl) +- [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) +- [Idiomatic Logging in Kotlin](https://www.baeldung.com/kotlin-logging) +- [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) +- [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection) +- [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) diff --git a/core-kotlin-modules/core-kotlin-advanced/pom.xml b/core-kotlin-modules/core-kotlin-advanced/pom.xml new file mode 100644 index 0000000000..5ddfef23cc --- /dev/null +++ b/core-kotlin-modules/core-kotlin-advanced/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + core-kotlin-advanced + core-kotlin-advanced + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/CallsInPlaceEffect.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/contract/ReturnsEffect.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/User.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/datamapping/User.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/User.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt similarity index 82% rename from core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt index 6113ed3591..1f3d7f3b47 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserExtensions.kt @@ -3,10 +3,10 @@ package com.baeldung.datamapping import kotlin.reflect.full.memberProperties fun User.toUserView() = UserView( - name = "$firstName $lastName", - address = "$street $houseNumber", - telephone = phone, - age = age + name = "$firstName $lastName", + address = "$street $houseNumber", + telephone = phone, + age = age ) fun User.toUserViewReflection() = with(::UserView) { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserView.kt similarity index 100% rename from core-kotlin/src/main/kotlin/com/baeldung/datamapping/UserView.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/datamapping/UserView.kt diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/dsl/SqlDsl.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/dsl/SqlDsl.kt similarity index 99% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/dsl/SqlDsl.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/dsl/SqlDsl.kt index 5296d301a3..207e9dbd53 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/dsl/SqlDsl.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/dsl/SqlDsl.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.dsl +package com.baeldung.dsl abstract class Condition { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnAny.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnAny.kt similarity index 94% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnAny.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnAny.kt index 32d968fff5..01edf5e871 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnAny.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnAny.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnMarkerInterface.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnMarkerInterface.kt similarity index 95% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnMarkerInterface.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnMarkerInterface.kt index b33d4c9f93..8210361345 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsExtensionOnMarkerInterface.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsExtensionOnMarkerInterface.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsProperty.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsProperty.kt similarity index 88% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsProperty.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsProperty.kt index 979b3b3a10..60ac0800e2 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsProperty.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsProperty.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging open class LoggerAsProperty { private val logger = getLogger(javaClass) diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsPropertyDelegate.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsPropertyDelegate.kt similarity index 92% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsPropertyDelegate.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsPropertyDelegate.kt index 23f04722be..83cde2b446 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerAsPropertyDelegate.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerAsPropertyDelegate.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger import kotlin.properties.ReadOnlyProperty @@ -43,5 +43,5 @@ fun main(args: Array) { class LoggerDelegate : ReadOnlyProperty { override fun getValue(thisRef: R, property: KProperty<*>) = - getLogger(getClassForLogging(thisRef.javaClass)) + getLogger(getClassForLogging(thisRef.javaClass)) } diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerInCompanionObject.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerInCompanionObject.kt similarity index 97% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerInCompanionObject.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerInCompanionObject.kt index f973606369..6a44675e45 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/LoggerInCompanionObject.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/LoggerInCompanionObject.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging open class LoggerInCompanionObject { companion object { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/Util.kt b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/Util.kt similarity index 91% rename from core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/Util.kt rename to core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/Util.kt index b9c0d9e34c..44dba53cb7 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/kotlin/logging/Util.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/main/kotlin/com/baeldung/logging/Util.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.logging +package com.baeldung.logging import org.slf4j.Logger import org.slf4j.LoggerFactory diff --git a/core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/datamapping/UserTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/datamapping/UserTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/datamapping/UserTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/dsl/SqlDslTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/dsl/SqlDslTest.kt similarity index 97% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/dsl/SqlDslTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/dsl/SqlDslTest.kt index 55ae44e4dc..a370e7f15d 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/dsl/SqlDslTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/dsl/SqlDslTest.kt @@ -1,8 +1,7 @@ -package com.baeldung.kotlin.dsl +package com.baeldung.dsl import org.assertj.core.api.Assertions.assertThat import org.junit.Test -import java.lang.Exception class SqlDslTest { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/JavaReflectionTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/JavaReflectionTest.kt similarity index 95% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/JavaReflectionTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/JavaReflectionTest.kt index 0d0e7b724d..c77774dd81 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/JavaReflectionTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/JavaReflectionTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.reflection +package com.baeldung.reflection import org.junit.Ignore import org.junit.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KClassTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KClassTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KClassTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KClassTest.kt index 56183b50be..f5d83cd13d 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KClassTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KClassTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.reflection +package com.baeldung.reflection import org.junit.Assert import org.junit.Ignore diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KMethodTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KMethodTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KMethodTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KMethodTest.kt index 17e9913731..b58c199a7c 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/reflection/KMethodTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/reflection/KMethodTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin.reflection +package com.baeldung.reflection import org.junit.Assert import org.junit.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/stdlib/RegexTest.kt b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/regex/RegexTest.kt similarity index 95% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/stdlib/RegexTest.kt rename to core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/regex/RegexTest.kt index eeb587ee22..5cb54b4dda 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/stdlib/RegexTest.kt +++ b/core-kotlin-modules/core-kotlin-advanced/src/test/kotlin/com/baeldung/regex/RegexTest.kt @@ -1,12 +1,7 @@ -package com.baeldung.kotlin.stdlib +package com.baeldung.regex import org.junit.Test -import java.beans.ExceptionListener -import java.beans.XMLEncoder -import java.io.* -import java.lang.Exception import kotlin.test.* -import kotlin.text.RegexOption.* class RegexTest { diff --git a/core-kotlin-modules/core-kotlin-collections/README.md b/core-kotlin-modules/core-kotlin-collections/README.md new file mode 100644 index 0000000000..bbea5869af --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/README.md @@ -0,0 +1,10 @@ +## Core Kotlin Collections + +This module contains articles about core Kotlin collections. + +### Relevant articles: +- [Split a List Into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) +- [Finding an Element in a List Using Kotlin](https://www.baeldung.com/kotlin-finding-element-in-list) +- [Overview of Kotlin Collections API](https://www.baeldung.com/kotlin-collections-api) +- [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) diff --git a/core-kotlin-modules/core-kotlin-collections/pom.xml b/core-kotlin-modules/core-kotlin-collections/pom.xml new file mode 100644 index 0000000000..52401d267c --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/pom.xml @@ -0,0 +1,47 @@ + + + 4.0.0 + core-kotlin-collections + core-kotlin-collections + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.apache.commons + commons-math3 + ${commons-math3.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.6.1 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/CollectionsTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/CollectionsTest.kt index 59d6adccac..64b1f72eab 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CollectionsTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/collections/CollectionsTest.kt @@ -1,9 +1,9 @@ -package com.baeldung.kotlin +package com.baeldung.collections import org.junit.Test -import kotlin.test.assertTrue -import kotlin.test.assertFalse import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertTrue class CollectionsTest { @@ -142,5 +142,5 @@ class CollectionsTest { val finalResult = theList.fold( 1000, { oldResult, currentItem -> oldResult + (currentItem *currentItem)}) print(finalResult) assertEquals(1091, finalResult) - } + } } \ No newline at end of file diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/ChunkedTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/DistinctTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DistinctTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/DistinctTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DistinctTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/DropTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DropTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/DropTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/DropTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/FilterTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/FilterTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/FilterTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/FilterTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/SliceTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/SliceTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/SliceTest.kt diff --git a/core-kotlin/src/test/kotlin/com/baeldung/filter/TakeTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/TakeTest.kt similarity index 100% rename from core-kotlin/src/test/kotlin/com/baeldung/filter/TakeTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/filter/TakeTest.kt diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/findelement/FindAnElementInAListUnitTest.kt similarity index 95% rename from core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/findelement/FindAnElementInAListUnitTest.kt index 6fa7983689..52e7e2a5b5 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/lists/ListsUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/findelement/FindAnElementInAListUnitTest.kt @@ -1,11 +1,11 @@ -package com.baeldung.lists +package com.baeldung.findelement import org.junit.jupiter.api.Test import kotlin.test.assertEquals import kotlin.test.assertFalse import kotlin.test.assertTrue -class ListsUnitTest { +class FindAnElementInAListUnitTest { var batmans: List = listOf("Christian Bale", "Michael Keaton", "Ben Affleck", "George Clooney") diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/ListToMapTest.kt similarity index 98% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/ListToMapTest.kt index e3477931bb..93e4f11fdf 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/ListToMapTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/ListToMapTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.listtomap import org.junit.Test import kotlin.test.assertTrue diff --git a/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/User.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/User.kt new file mode 100644 index 0000000000..89eb9ac701 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/listtomap/User.kt @@ -0,0 +1,3 @@ +package com.baeldung.listtomap + +data class User(val name: String, val age: Int, val hobbies: List) diff --git a/core-kotlin-2/src/test/kotlin/com/baeldung/splitting/SplittingTest.kt b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/splitlist/SplitListIntoPartsTest.kt similarity index 98% rename from core-kotlin-2/src/test/kotlin/com/baeldung/splitting/SplittingTest.kt rename to core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/splitlist/SplitListIntoPartsTest.kt index a9ddc99992..627c7eaacf 100644 --- a/core-kotlin-2/src/test/kotlin/com/baeldung/splitting/SplittingTest.kt +++ b/core-kotlin-modules/core-kotlin-collections/src/test/kotlin/com/baeldung/splitlist/SplitListIntoPartsTest.kt @@ -1,9 +1,9 @@ -package com.baeldung.lambda +package com.baeldung.splitlist import org.junit.jupiter.api.Test import kotlin.test.assertEquals -class SplittingTest { +class SplitListIntoPartsTest { private val evenList = listOf(0, "a", 1, "b", 2, "c"); private val unevenList = listOf(0, "a", 1, "b", 2, "c", 3); diff --git a/core-kotlin-modules/core-kotlin-concurrency/README.md b/core-kotlin-modules/core-kotlin-concurrency/README.md new file mode 100644 index 0000000000..09d9055a2b --- /dev/null +++ b/core-kotlin-modules/core-kotlin-concurrency/README.md @@ -0,0 +1,7 @@ +## Core Kotlin Concurrency + +This module contains articles about concurrency in Kotlin. + +### Relevant articles: +- [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines) +- [Introduction to Kotlin Coroutines](https://www.baeldung.com/kotlin-coroutines) diff --git a/core-kotlin-modules/core-kotlin-concurrency/pom.xml b/core-kotlin-modules/core-kotlin-concurrency/pom.xml new file mode 100644 index 0000000000..7c3b0fb5b6 --- /dev/null +++ b/core-kotlin-modules/core-kotlin-concurrency/pom.xml @@ -0,0 +1,41 @@ + + + 4.0.0 + core-kotlin-concurrency + core-kotlin-concurrency + jar + + + com.baeldung.core-kotlin-modules + core-kotlin-modules + 1.0.0-SNAPSHOT + + + + + org.jetbrains.kotlin + kotlin-stdlib-jdk8 + ${kotlin.version} + + + org.assertj + assertj-core + ${assertj.version} + test + + + org.jetbrains.kotlin + kotlin-test + ${kotlin.version} + test + + + + + 1.3.30 + 3.10.0 + + + \ No newline at end of file diff --git a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleRunnable.kt similarity index 74% rename from core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleRunnable.kt index 7bc0528d06..80ffb4077a 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleRunnable.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleRunnable.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines class SimpleRunnable: Runnable { diff --git a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleThread.kt similarity index 74% rename from core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleThread.kt index 2b2827ae02..6647dac0ef 100644 --- a/core-kotlin/src/main/kotlin/com/baeldung/thread/SimpleThread.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/main/kotlin/com/baeldung/threadsvscoroutines/SimpleThread.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines class SimpleThread: Thread() { diff --git a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/coroutines/CoroutinesUnitTest.kt similarity index 99% rename from core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/coroutines/CoroutinesUnitTest.kt index 324cf1109b..6b9437a8ab 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/kotlin/CoroutinesUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/coroutines/CoroutinesUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.kotlin +package com.baeldung.coroutines import kotlinx.coroutines.* import org.junit.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/CoroutineUnitTest.kt similarity index 96% rename from core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/CoroutineUnitTest.kt index 1f1609b06b..ff385d0869 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/thread/CoroutineUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/CoroutineUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines import kotlinx.coroutines.* import org.junit.jupiter.api.Test diff --git a/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/ThreadUnitTest.kt similarity index 94% rename from core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt rename to core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/ThreadUnitTest.kt index fa2f1edc36..9503751fa3 100644 --- a/core-kotlin/src/test/kotlin/com/baeldung/thread/ThreadUnitTest.kt +++ b/core-kotlin-modules/core-kotlin-concurrency/src/test/kotlin/com/baeldung/threadsvscoroutines/ThreadUnitTest.kt @@ -1,4 +1,4 @@ -package com.baeldung.thread +package com.baeldung.threadsvscoroutines import org.junit.jupiter.api.Test import kotlin.concurrent.thread diff --git a/core-kotlin-modules/pom.xml b/core-kotlin-modules/pom.xml index 1abea86289..c178febdfd 100644 --- a/core-kotlin-modules/pom.xml +++ b/core-kotlin-modules/pom.xml @@ -15,7 +15,10 @@ + core-kotlin-advanced core-kotlin-annotations + core-kotlin-collections + core-kotlin-concurrency core-kotlin-io core-kotlin-lang core-kotlin-lang-2 diff --git a/core-kotlin/README.md b/core-kotlin/README.md index 785eb0b689..89e1b7287e 100644 --- a/core-kotlin/README.md +++ b/core-kotlin/README.md @@ -7,37 +7,26 @@ This module contains articles about core Kotlin. - [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin) - [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability) - [Generics in Kotlin](https://www.baeldung.com/kotlin-generics) -- [Introduction to Kotlin Coroutines](https://www.baeldung.com/kotlin-coroutines) -- [Overview of Kotlin Collections API](https://www.baeldung.com/kotlin-collections-api) -- [Converting a List to Map in Kotlin](https://www.baeldung.com/kotlin-list-to-map) - [Data Classes in Kotlin](https://www.baeldung.com/kotlin-data-classes) - [Delegated Properties in Kotlin](https://www.baeldung.com/kotlin-delegated-properties) - [Sealed Classes in Kotlin](https://www.baeldung.com/kotlin-sealed-classes) - [JUnit 5 for Kotlin Developers](https://www.baeldung.com/junit-5-kotlin) - [Extension Methods in Kotlin](https://www.baeldung.com/kotlin-extension-methods) -- [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) - [Objects in Kotlin](https://www.baeldung.com/kotlin-objects) -- [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) - [Working with Enums in Kotlin](https://www.baeldung.com/kotlin-enum) - [Create a Java and Kotlin Project with Maven](https://www.baeldung.com/kotlin-maven-java-project) -- [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection) - [Get a Random Number in Kotlin](https://www.baeldung.com/kotlin-random-number) -- [Idiomatic Logging in Kotlin](https://www.baeldung.com/kotlin-logging) - [Kotlin Constructors](https://www.baeldung.com/kotlin-constructors) - [Creational Design Patterns in Kotlin: Builder](https://www.baeldung.com/kotlin-builder-pattern) - [Kotlin Nested and Inner Classes](https://www.baeldung.com/kotlin-inner-classes) - [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel) - [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant) - [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class) -- [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) -- [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines) - [Guide to Kotlin Interfaces](https://www.baeldung.com/kotlin-interfaces) - [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) - [Dependency Injection for Kotlin with Injekt](https://www.baeldung.com/kotlin-dependency-injection-with-injekt) - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree) -- [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) -- [Building DSLs in Kotlin](https://www.baeldung.com/kotlin-dsl) - [Static Methods Behavior in Kotlin](https://www.baeldung.com/kotlin-static-methods) - [Delegation Pattern in Kotlin](https://www.baeldung.com/kotlin-delegation-pattern) - More articles: [[next -->]](/core-kotlin-2) diff --git a/core-kotlin/pom.xml b/core-kotlin/pom.xml index 63a6d8035e..5fe8a47f62 100644 --- a/core-kotlin/pom.xml +++ b/core-kotlin/pom.xml @@ -14,11 +14,6 @@ - - org.apache.commons - commons-math3 - ${commons-math3.version} - org.apache.commons commons-lang3 @@ -75,7 +70,6 @@ - 3.6.1 1.1.1 5.2.0 3.10.0