Kotlin basics

import org.junit.Assert
import org.junit.Test

class MyTest {

    // immutable data class
    data class User(
            val firstname: String,
            val lastname: String
    )

    // immutable data class with optional values and nullable value
    data class Customer(
            val name: String = "", // name cannot be null
            val address: String? = "" // address can also be null
    )
Lees meer »