Merge pull request #8387 from catalin-burcea/BAEL-19883

[BAEL-19883] - Move articles out of core-kotlin part2
This commit is contained in:
Josh Cummings 2019-12-26 23:05:22 -07:00 committed by GitHub
commit 05fe20164d
58 changed files with 85 additions and 41 deletions

View File

@ -4,9 +4,6 @@ This module contains articles about core Kotlin.
### Relevant articles: ### Relevant articles:
- [Void Type in Kotlin](https://www.baeldung.com/kotlin-void-type)
- [How to use Kotlin Range Expressions](https://www.baeldung.com/kotlin-ranges)
- [Creating a Kotlin Range Iterator on a Custom Object](https://www.baeldung.com/kotlin-custom-range-iterator)
- [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions) - [Kotlin Scope Functions](https://www.baeldung.com/kotlin-scope-functions)
- [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations) - [Kotlin Annotations](https://www.baeldung.com/kotlin-annotations)
- [Split a List into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts) - [Split a List into Parts in Kotlin](https://www.baeldung.com/kotlin-split-list-into-parts)

View File

@ -0,0 +1,13 @@
## Core Kotlin Lang
This module contains articles about core features in the Kotlin language.
### Relevant articles:
- [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue)
- [Infix Functions in Kotlin](https://www.baeldung.com/kotlin-infix-functions)
- [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions)
- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final)
- [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)
- [[<-- Prev]](/core-kotlin-modules/core-kotlin-lang)

View File

@ -0,0 +1,16 @@
<?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-lang-2</artifactId>
<name>core-kotlin-lang-2</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung.core-kotlin-modules</groupId>
<artifactId>core-kotlin-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
</project>

View File

@ -1,7 +1,5 @@
package com.baeldung.kotlin; package com.baeldung.lazy;
import com.baeldung.lazy.ClassWithHeavyInitialization;
import org.junit.Test; import org.junit.Test;
import static junit.framework.TestCase.assertTrue; import static junit.framework.TestCase.assertTrue;

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.arrayinitialization
import org.junit.Test import org.junit.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals

View File

@ -1,5 +1,5 @@
import com.baeldung.kotlin.constant.TestKotlinConstantClass package com.baeldung.constant
import com.baeldung.kotlin.constant.TestKotlinConstantObject
import org.junit.jupiter.api.Test import org.junit.jupiter.api.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin.constant package com.baeldung.constant
class TestKotlinConstantClass { class TestKotlinConstantClass {

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin.constant package com.baeldung.constant
object TestKotlinConstantObject { object TestKotlinConstantObject {

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.infixfunctions
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test

View File

@ -6,6 +6,7 @@ import org.junit.jupiter.api.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
class LambdaTest { class LambdaTest {
@Test @Test
fun whenCallingALambda_thenPerformTheAction() { fun whenCallingALambda_thenPerformTheAction() {
assertEquals(9, inferredType(3)) assertEquals(9, inferredType(3))

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.lazy
import org.junit.Test import org.junit.Test
import java.util.concurrent.CountDownLatch import java.util.concurrent.CountDownLatch

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.nullsafety
import org.junit.Test import org.junit.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
@ -8,6 +8,7 @@ import kotlin.test.assertTrue
class NullSafetyTest { class NullSafetyTest {
@Test @Test
fun givenNonNullableField_whenAssignValueToIt_thenNotNeedToCheckAgainstNull() { fun givenNonNullableField_whenAssignValueToIt_thenNotNeedToCheckAgainstNull() {
//given //given

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.structuraljump
import org.junit.Test import org.junit.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals

View File

@ -0,0 +1,16 @@
## Core Kotlin Lang
This module contains articles about core features in the Kotlin language.
### Relevant articles:
- [Guide to the “when{}” Block in Kotlin](https://www.baeldung.com/kotlin-when)
- [Difference Between “==” and “===” Operators in Kotlin](https://www.baeldung.com/kotlin-equality-operators)
- [Nested forEach in Kotlin](https://www.baeldung.com/kotlin-nested-foreach)
- [Destructuring Declarations in Kotlin](https://www.baeldung.com/kotlin-destructuring-declarations)
- [Try-with-resources in Kotlin](https://www.baeldung.com/kotlin-try-with-resources)
- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading)
- [Inline Functions in Kotlin](https://www.baeldung.com/kotlin-inline-functions)
- [Void Type in Kotlin](https://www.baeldung.com/kotlin-void-type)
- [How to use Kotlin Range Expressions](https://www.baeldung.com/kotlin-ranges)
- [Creating a Kotlin Range Iterator on a Custom Object](https://www.baeldung.com/kotlin-custom-range-iterator)
- [[More --> ]](/core-kotlin-modules/core-kotlin-lang-2)

View File

@ -0,0 +1,16 @@
<?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-lang</artifactId>
<name>core-kotlin-lang</name>
<packaging>jar</packaging>
<parent>
<groupId>com.baeldung.core-kotlin-modules</groupId>
<artifactId>core-kotlin-modules</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
</project>

View File

@ -1,7 +1,5 @@
package com.baeldung.destructuringdeclarations package com.baeldung.destructuringdeclarations
import com.baeldung.destructuringdeclarations.Person
fun main(args: Array<String>) { fun main(args: Array<String>) {
//2.1. Objects //2.1. Objects

View File

@ -1,3 +1,3 @@
package com.baeldung.kotlin package com.baeldung.equalityoperators
data class User(val name: String, val age: Int, val hobbies: List<String>) data class User(val name: String, val age: Int, val hobbies: List<String>)

View File

@ -1,4 +1,4 @@
package com.baeldung.functions package com.baeldung.inline
import kotlin.random.Random import kotlin.random.Random

View File

@ -1,4 +1,4 @@
package com.baeldung.range package com.baeldung.rangeiterator
import java.lang.IllegalStateException import java.lang.IllegalStateException
@ -8,7 +8,7 @@ class CustomColor(val rgb: Int): Comparable<CustomColor> {
return this.rgb.compareTo(other.rgb) return this.rgb.compareTo(other.rgb)
} }
operator fun rangeTo(that: CustomColor) = ColorRange(this,that) operator fun rangeTo(that: CustomColor) = ColorRange(this, that)
operator fun inc(): CustomColor { operator fun inc(): CustomColor {
return CustomColor(rgb + 1) return CustomColor(rgb + 1)
@ -25,7 +25,7 @@ class CustomColor(val rgb: Int): Comparable<CustomColor> {
} }
} }
class ColorRange(override val start: CustomColor, class ColorRange(override val start: CustomColor,
override val endInclusive: CustomColor) : ClosedRange<CustomColor>, Iterable<CustomColor>{ override val endInclusive: CustomColor) : ClosedRange<CustomColor>, Iterable<CustomColor>{
override fun iterator(): Iterator<CustomColor> { override fun iterator(): Iterator<CustomColor> {
return ColorIterator(start, endInclusive) return ColorIterator(start, endInclusive)

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.whenblock
enum class UnixFileType { enum class UnixFileType {
D, HYPHEN_MINUS, L D, HYPHEN_MINUS, L

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.equalityoperators
import org.junit.Test import org.junit.Test
import kotlin.test.assertFalse import kotlin.test.assertFalse

View File

@ -1,4 +1,4 @@
package com.baeldung.range package com.baeldung.rangeiterator
import org.junit.Test import org.junit.Test
import java.lang.IllegalStateException import java.lang.IllegalStateException

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.trywithresource
import org.junit.Test import org.junit.Test
import java.beans.ExceptionListener import java.beans.ExceptionListener

View File

@ -1,4 +1,4 @@
package com.baeldung.kotlin package com.baeldung.whenblock
import org.junit.Assert.assertEquals import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue import org.junit.Assert.assertTrue

View File

@ -17,6 +17,8 @@
<modules> <modules>
<module>core-kotlin-annotations</module> <module>core-kotlin-annotations</module>
<module>core-kotlin-io</module> <module>core-kotlin-io</module>
<module>core-kotlin-lang</module>
<module>core-kotlin-lang-2</module>
<module>core-kotlin-strings</module> <module>core-kotlin-strings</module>
</modules> </modules>

View File

@ -5,14 +5,9 @@ This module contains articles about core Kotlin.
### Relevant articles: ### Relevant articles:
- [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin) - [Introduction to the Kotlin Language](https://www.baeldung.com/kotlin)
- [Guide to the “when{}” Block in Kotlin](https://www.baeldung.com/kotlin-when)
- [Comprehensive Guide to Null Safety in Kotlin](https://www.baeldung.com/kotlin-null-safety)
- [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability) - [Kotlin Java Interoperability](https://www.baeldung.com/kotlin-java-interoperability)
- [Difference Between “==” and “===” operators in Kotlin](https://www.baeldung.com/kotlin-equality-operators)
- [Generics in Kotlin](https://www.baeldung.com/kotlin-generics) - [Generics in Kotlin](https://www.baeldung.com/kotlin-generics)
- [Introduction to Kotlin Coroutines](https://www.baeldung.com/kotlin-coroutines) - [Introduction to Kotlin Coroutines](https://www.baeldung.com/kotlin-coroutines)
- [Destructuring Declarations in Kotlin](https://www.baeldung.com/kotlin-destructuring-declarations)
- [Lazy Initialization in Kotlin](https://www.baeldung.com/kotlin-lazy-initialization)
- [Overview of Kotlin Collections API](https://www.baeldung.com/kotlin-collections-api) - [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) - [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) - [Data Classes in Kotlin](https://www.baeldung.com/kotlin-data-classes)
@ -20,12 +15,9 @@ This module contains articles about core Kotlin.
- [Sealed Classes in Kotlin](https://www.baeldung.com/kotlin-sealed-classes) - [Sealed Classes in Kotlin](https://www.baeldung.com/kotlin-sealed-classes)
- [JUnit 5 for Kotlin Developers](https://www.baeldung.com/junit-5-kotlin) - [JUnit 5 for Kotlin Developers](https://www.baeldung.com/junit-5-kotlin)
- [Extension Methods in Kotlin](https://www.baeldung.com/kotlin-extension-methods) - [Extension Methods in Kotlin](https://www.baeldung.com/kotlin-extension-methods)
- [Infix Functions in Kotlin](https://www.baeldung.com/kotlin-infix-functions)
- [Try-with-resources in Kotlin](https://www.baeldung.com/kotlin-try-with-resources)
- [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions) - [Regular Expressions in Kotlin](https://www.baeldung.com/kotlin-regular-expressions)
- [Objects in Kotlin](https://www.baeldung.com/kotlin-objects) - [Objects in Kotlin](https://www.baeldung.com/kotlin-objects)
- [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection) - [Filtering Kotlin Collections](https://www.baeldung.com/kotlin-filter-collection)
- [Lambda Expressions in Kotlin](https://www.baeldung.com/kotlin-lambda-expressions)
- [Working with Enums in Kotlin](https://www.baeldung.com/kotlin-enum) - [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) - [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) - [Reflection with Kotlin](https://www.baeldung.com/kotlin-reflection)
@ -37,21 +29,15 @@ This module contains articles about core Kotlin.
- [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel) - [Fuel HTTP Library with Kotlin](https://www.baeldung.com/kotlin-fuel)
- [Introduction to Kovenant Library for Kotlin](https://www.baeldung.com/kotlin-kovenant) - [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) - [Converting Kotlin Data Class from JSON using GSON](https://www.baeldung.com/kotlin-json-convert-data-class)
- [Kotlin return, break, continue Keywords](https://www.baeldung.com/kotlin-return-break-continue)
- [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects) - [Mapping of Data Objects in Kotlin](https://www.baeldung.com/kotlin-data-objects)
- [Initializing Arrays in Kotlin](https://www.baeldung.com/kotlin-initialize-array)
- [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines) - [Threads vs Coroutines in Kotlin](https://www.baeldung.com/kotlin-threads-coroutines)
- [Guide to Kotlin Interfaces](https://www.baeldung.com/kotlin-interfaces) - [Guide to Kotlin Interfaces](https://www.baeldung.com/kotlin-interfaces)
- [Guide to Sorting in Kotlin](https://www.baeldung.com/kotlin-sort) - [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) - [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) - [Implementing a Binary Tree in Kotlin](https://www.baeldung.com/kotlin-binary-tree)
- [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts) - [Kotlin Contracts](https://www.baeldung.com/kotlin-contracts)
- [Operator Overloading in Kotlin](https://www.baeldung.com/kotlin-operator-overloading)
- [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes) - [Inline Classes in Kotlin](https://www.baeldung.com/kotlin-inline-classes)
- [Creating Java static final Equivalents in Kotlin](https://www.baeldung.com/kotlin-java-static-final)
- [Nested forEach in Kotlin](https://www.baeldung.com/kotlin-nested-foreach)
- [Building DSLs in Kotlin](https://www.baeldung.com/kotlin-dsl) - [Building DSLs in Kotlin](https://www.baeldung.com/kotlin-dsl)
- [Static Methods Behavior in Kotlin](https://www.baeldung.com/kotlin-static-methods) - [Static Methods Behavior in Kotlin](https://www.baeldung.com/kotlin-static-methods)
- [Inline Functions in Kotlin](https://www.baeldung.com/kotlin-inline-functions)
- [Delegation Pattern in Kotlin](https://www.baeldung.com/kotlin-delegation-pattern) - [Delegation Pattern in Kotlin](https://www.baeldung.com/kotlin-delegation-pattern)
- More articles: [[next -->]](/core-kotlin-2) - More articles: [[next -->]](/core-kotlin-2)