Skip to content

Commit

Permalink
[BAEL-19885] - Move articles out of core-kotlin part4
Browse files Browse the repository at this point in the history
  • Loading branch information
catalin-burcea committed Dec 27, 2019
1 parent b38e420 commit 5e9a17c
Show file tree
Hide file tree
Showing 44 changed files with 194 additions and 57 deletions.
3 changes: 0 additions & 3 deletions core-kotlin-2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
11 changes: 11 additions & 0 deletions core-kotlin-modules/core-kotlin-advanced/README.md
Original file line number Diff line number Diff line change
@@ -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)
41 changes: 41 additions & 0 deletions core-kotlin-modules/core-kotlin-advanced/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-kotlin-advanced</artifactId>
<name>core-kotlin-advanced</name>
<packaging>jar</packaging>

<parent>
<groupId>com.baeldung.core-kotlin-modules</groupId>
<artifactId>core-kotlin-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<kotlin.version>1.3.30</kotlin.version>
<assertj.version>3.10.0</assertj.version>
</properties>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.dsl
package com.baeldung.dsl

abstract class Condition {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.logging
package com.baeldung.logging

import org.slf4j.Logger

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.logging
package com.baeldung.logging

import org.slf4j.Logger
import org.slf4j.LoggerFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.logging
package com.baeldung.logging

open class LoggerAsProperty {
private val logger = getLogger(javaClass)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.logging
package com.baeldung.logging

import org.slf4j.Logger
import kotlin.properties.ReadOnlyProperty
Expand Down Expand Up @@ -43,5 +43,5 @@ fun main(args: Array<String>) {

class LoggerDelegate<in R : Any> : ReadOnlyProperty<R, Logger> {
override fun getValue(thisRef: R, property: KProperty<*>) =
getLogger(getClassForLogging(thisRef.javaClass))
getLogger(getClassForLogging(thisRef.javaClass))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.logging
package com.baeldung.logging

open class LoggerInCompanionObject {
companion object {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.logging
package com.baeldung.logging

import org.slf4j.Logger
import org.slf4j.LoggerFactory
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.reflection
package com.baeldung.reflection

import org.junit.Ignore
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.reflection
package com.baeldung.reflection

import org.junit.Assert
import org.junit.Ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin.reflection
package com.baeldung.reflection

import org.junit.Assert
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down
10 changes: 10 additions & 0 deletions core-kotlin-modules/core-kotlin-collections/README.md
Original file line number Diff line number Diff line change
@@ -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)
47 changes: 47 additions & 0 deletions core-kotlin-modules/core-kotlin-collections/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-kotlin-collections</artifactId>
<name>core-kotlin-collections</name>
<packaging>jar</packaging>

<parent>
<groupId>com.baeldung.core-kotlin-modules</groupId>
<artifactId>core-kotlin-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>${commons-math3.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<kotlin.version>1.3.30</kotlin.version>
<commons-math3.version>3.6.1</commons-math3.version>
<assertj.version>3.10.0</assertj.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -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 {

Expand Down Expand Up @@ -142,5 +142,5 @@ class CollectionsTest {
val finalResult = theList.fold( 1000, { oldResult, currentItem -> oldResult + (currentItem *currentItem)})
print(finalResult)
assertEquals(1091, finalResult)
}
}
}
Original file line number Diff line number Diff line change
@@ -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<String> = listOf("Christian Bale", "Michael Keaton", "Ben Affleck", "George Clooney")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.listtomap

import org.junit.Test
import kotlin.test.assertTrue
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.baeldung.listtomap

data class User(val name: String, val age: Int, val hobbies: List<String>)
Original file line number Diff line number Diff line change
@@ -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);
Expand Down
7 changes: 7 additions & 0 deletions core-kotlin-modules/core-kotlin-concurrency/README.md
Original file line number Diff line number Diff line change
@@ -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)
41 changes: 41 additions & 0 deletions core-kotlin-modules/core-kotlin-concurrency/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>core-kotlin-concurrency</artifactId>
<name>core-kotlin-concurrency</name>
<packaging>jar</packaging>

<parent>
<groupId>com.baeldung.core-kotlin-modules</groupId>
<artifactId>core-kotlin-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

<dependencies>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-jdk8</artifactId>
<version>${kotlin.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-test</artifactId>
<version>${kotlin.version}</version>
<scope>test</scope>
</dependency>
</dependencies>

<properties>
<kotlin.version>1.3.30</kotlin.version>
<assertj.version>3.10.0</assertj.version>
</properties>

</project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thread
package com.baeldung.threadsvscoroutines

class SimpleRunnable: Runnable {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thread
package com.baeldung.threadsvscoroutines

class SimpleThread: Thread() {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.kotlin
package com.baeldung.coroutines

import kotlinx.coroutines.*
import org.junit.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thread
package com.baeldung.threadsvscoroutines

import kotlinx.coroutines.*
import org.junit.jupiter.api.Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.baeldung.thread
package com.baeldung.threadsvscoroutines

import org.junit.jupiter.api.Test
import kotlin.concurrent.thread
Expand Down
3 changes: 3 additions & 0 deletions core-kotlin-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
</parent>

<modules>
<module>core-kotlin-advanced</module>
<module>core-kotlin-annotations</module>
<module>core-kotlin-collections</module>
<module>core-kotlin-concurrency</module>
<module>core-kotlin-io</module>
<module>core-kotlin-lang</module>
<module>core-kotlin-lang-2</module>
Expand Down
Loading

0 comments on commit 5e9a17c

Please sign in to comment.