Examples of Getting Started vídeos

Overview

Getting Started Kotlin

Learn the basics of getting started with kotlin

Build Kotlin Maven Central Analytics

--->>> Repo: Kotlin Koans <<<---

--->>> Repo: Problems Kotlin <<<---

--->>> Repo: GameBoy Emulator Enviroment <<<---

--->>> Repo: Kotlin Mobile <<<---

--->>> Repo: Kotlin JavaScript <<<---

--->>> Repo: Kotlin Native - iOS <<<---

--->>> Repo: Ktor Examples <<<---

Indexes

Hello World

Main.kt

fun main(args: Array<String>) {
    val printHelloWorld = PrintHelloWorld()
    basic(printHelloWorld)
    basicEmpty(printHelloWorld)
    empty(printHelloWorld)
}

private fun empty(printHelloWorld: PrintHelloWorld) {
    printHelloWorld.empty()
}

private fun basicEmpty(printHelloWorld: PrintHelloWorld) {
    printHelloWorld.basicEmpty()
}

private fun basic(printHelloWorld: PrintHelloWorld) {
    val name = "Victor"
    printHelloWorld.basic(name)
}

PrintHelloWorld.kt

public class PrintHelloWorld{
    companion object { val HELLO_WORLD = "Hello World " }
    public fun basic(name:String){
        println(HELLO_WORLD+name)
    }

    public fun basicEmpty(name:String = ""){
        println(HELLO_WORLD+name)
    }

    public fun empty(){
        println(HELLO_WORLD)
    }
}

Result

Hello World Victor
Hello World 
Hello World 

Basic Variables

Main.kt

fun main(args: Array<String>) {

    immutableValue()
    mutableValue()
    nullableValue()
}

private fun immutableValue() {
    val name  = "Victor"
    //immutable prototype
    //val name : String = "Victor"
    // name = "Victor Manuel"   Error!
    println(name)

}

private fun mutableValue() {
    //mutable prototype
    var lastName: String
    lastName = "Victor Bolinches"
    println(lastName)

}

private fun nullableValue() {
    //var lastNameNullable: String   Error!
    //lastNameNullable = null        Error!

    var lastNameNullable: String?
    lastNameNullable = null
    println(lastNameNullable)
    lastNameNullable = "Victor Manuel Bolinches"
    println(lastNameNullable)
}

Result

Victor
Victor Bolinches
null
Victor Manuel Bolinches

Static Values

Main.kt

fun main(args: Array<String>) {
    start()
    stop()
}

fun start() = println("State static: ${State.START}")
fun stop()  = println("State static: ${State.STOP}")

State.kt

public class State {
    companion object {
        val START = 1
        val STOP = 0
    }
}

Result

State static = 0
State static = 1

Strings

Main.kt

fun main(args: Array<String>) {
    literals()
    templates()
}

private fun templates() {
    val number = 18
    val name = "vicboma $number"
    println(name)

    println("$name.length = ${name.length}")

    val price = "${'$'}9.99 = 9.99 dollars"
    println(price)
}

private fun literals() {
    val helloWorld = "Hello, world!"
    println(helloWorld)
    val str = "Hello, world!\n..."   // w/backslash
    println(str)
}

Result

Hello, world!
Hello, world!
...
vicboma 18
vicboma 18.length = 10
$9.99 = 9.99 dollars

Boolean Operators

Main.kt

fun main(args: Array<String>) {
    disjunction()
    conjunction()
    negation()
}

private fun negation() {
    val list = arrayOf(
        BooleanOperator.negation(false),
        BooleanOperator.negation(true)
    )

    printlnResult(list)
}

private fun conjunction() {
    val list = arrayOf(
         BooleanOperator.lazyConjunction(false, false),
         BooleanOperator.lazyConjunction(false, true),
         BooleanOperator.lazyConjunction(true, false),
         BooleanOperator.lazyConjunction(true, true)
    )

    printlnResult(list)
}

private fun disjunction() {
    val list = arrayOf(
        BooleanOperator.lazyDisjunction(false, false),
        BooleanOperator.lazyDisjunction(false, true),
        BooleanOperator.lazyDisjunction(true, false),
        BooleanOperator.lazyDisjunction(true, true)
    )

    printlnResult(list)
}

fun printlnResult(values:Array<Boolean>){
    for(x in values){
        println(x)
    }
}

BooleanOperator.kt

class BooleanOperator{
    companion object {
        fun lazyDisjunction(cond1: Boolean, cond2: Boolean) = cond1 || cond2
        fun lazyConjunction(cond1: Boolean, cond2: Boolean) = cond1 && cond2
        fun negation(cond1: Boolean) = !cond1;
    }
}

Result

//Disjunction
false false = false
false true  = true
true  false = true
true  true  = true

//Conjunction
false false = false
false true  = false
true  false = false
true  true  = true

//Negation
false = true
true  = false

Conditional

Main.kt

fun main(args: Array<String>) {
    val math : Math = Math()
    max(math)
    min(math)
    maxIn(math)
    minIn(math)
    lambdas(math)
}

private fun lambdas(math: Math) {
    val maxLambda: (Int, Int) -> Int = { x, y -> if (x > y) x else y }
    val minLambda: (Int, Int) -> Int = { x, y -> if (x > y) y else x }

    val inFunctionMax = math.inFunction(100, 3, maxLambda)
    val inFunctionMin = math.inFunction(100, 3, minLambda)

    println(inFunctionMax)
    println(inFunctionMin)
}

private fun minIn(math: Math) {
    val minIn = math.minIn(4, 1)
    val minIn1 = math.minIn(4, 4)
    println(minIn)
    println(minIn1)
}

private fun maxIn(math: Math) {
    val maxIn = math.maxIn(3, 6)
    println(maxIn)
}

private fun min(math: Math) {
    val min = math.min(8, 0)
    println(min)
}

private fun max(math: Math) {
    val max = math.max(6, 7)
    println(max)
}

Math.kt

class Math {
    fun max(a: Int, b: Int): Int {
        if (a > b) {
            return a
        } else {
            return b
        }
    }

    fun min(a: Int, b: Int): Int {
        if (a > b) {
            return b
        } else {
            return a
        }
    }

    fun maxIn(a: Int, b: Int): Int = if(a > b) a else b

    fun minIn(a: Int, b: Int): Int = if (a > b) b else a

    //val max : (Int, Int) -> Int = { x , y -> if (x > y) x else y }
    //val min : (Int, Int) -> Int = { x , y -> if (x > y) y else x }

    fun inFunction(x : Int, y : Int, f:(Int, Int) -> Int) : Int {
        return f(x,y)
    }
}

Result

7
0
6
1
100
3
4

Control Flow

While

Main.kt

fun main(args: Array<String>) {
    ArrayWithIterator()
    ArrayDoWhile()
    classic()
}

private fun ArrayDoWhile() {
    var arraySafety = arrayOf<Any?>(1, 2, 3, 4, 5, null)
    doWhile(arraySafety)
}

private fun ArrayWithIterator() {
    var arrayAny = arrayOf(1, 2, 3, 4, 5)
    withIterator(arrayAny)
}

private fun classic() {
    var i = 5
    while (0 <= i) {
        println(i--)
    }
}

private fun doWhile(arraySafety: Array<Any?>) {
    val iterator = arraySafety.iterator()
    do {
        val y = iterator.next()
        println(y)
    } while (y != null) // y is visible here!
}

private fun withIterator(arrayAny: Array<Int>) {
    val iterator = arrayAny.iterator()
    while (iterator.hasNext()) {
        val next = iterator.next()
        println(next)
    }
}

Result

1
2
3
4
5

1
2
3
4
5
null

5
4
3
2
1
0

For

Main.kt

fun main(args: Array<String>) {

    var arrayAny = arrayOf(12,2.3,45F,"Soy una String",true, null)
    anIterator(arrayAny)
    withBodyBlock(arrayAny)
    withIndices(arrayAny)
}

private fun withIndices(arrayAny: Array<Any?>) {
    for (i in arrayAny.indices)
        println(arrayAny[i])
}

private fun anIterator(arrayAny: Array<Any?>) {
    for (any in arrayAny)
        println(any)
}

private fun withBodyBlock(arrayAny: Array<Any?>) {
    for (any: Any? in arrayAny) {
        print(any)
        print("\n")
    }
}

Result

12
2.3
45.0
Soy una String
true
null

12
2.3
45.0
Soy una String
true
null

12
2.3
45.0
Soy una String
true
null

When

Main.kt

fun main(args: Array<String>) {
    var array = arrayOf(1,2,3)
    forWhenDefault(array)
    forWhenCombined(array)
    forImplicitCast()
    expression()
}

private fun expression() {
    var arrayNumber = arrayOf(1, 2, 19, 20, 14, 35, 45)
    expression(arrayNumber)
}

private fun forImplicitCast() {
    var arrayAny = arrayOf<Any?>(1, 2.0, 5F, "", true)
    implicitCasts(arrayAny)
}

private fun forWhenCombined(array: Array<Int>) {
    for (i in array)
        whenCombined(i)
}

private fun forWhenDefault(array: Array<Int>) {
    for (i in array)
        _whenDefault(i)
}

/**
 * We can also check a value For being in or !in a range or a collection:
 */
private fun expression(arrayNumber: Array<Int>) {
    val validNumbers = arrayOf(35)
    for (obj in arrayNumber)
        when (obj) {
            in 1..10 -> println("x is in the range")
            in validNumbers -> println("x is valid")
            !in 10..20 -> println("x is outside the range")
            else -> println("none of the above")
        }
}

/**
 * with patter matching
 */
private fun implicitCasts(arrayAny: Array<Any?>) {
    for (obj in arrayAny)
        when (obj) {
            is String -> println("is String")
            is Int -> println("is Int")
            is Float -> println("is Float")
            is Double -> println("is Double")
            !is Boolean -> println("is not Boolean")
            else -> println("is Boolean ")
        }
}


/**
 * If many cases should be handled in the same way, the branch conditions may be combined with a comma
 */
private fun whenCombined(i: Int) {
    when (i) {
        0, 1 -> println("x == 0 or x == 1")
        else -> println("otherwise")
    }
}

/**
 * when replaces the switch operator of C-like languages
 * when can be used either as an expression or as a statement
 */
private fun _whenDefault(x: Int) {
    when (x) {
        1 -> println("x == 1")
        2 -> println("x == 2")
        else -> {
            // Note the block
            println("x is neither 1 nor 2")
        }
    }
}

Result

x == 1
x == 2
x is neither 1 nor 

x == 0 or x == 1
otherwise
otherwise

is Int
is Double
is Float
is String
is Boolean 

x is in the range
x is in the range
none of the above
none of the above
none of the above
x is valid
x is outside the range

Return and Jump

Kotlin has three structural jump operators

    • return. By default returns from the nearest enclosing function or function expression.
  • — break. Terminates the nearest enclosing loop.
    • continue. Proceeds to the next step of the nearest enclosing loop.
fun main(args: Array<String>) {
    returnBasic()
    inlineReturn()
    implicitReturn()
    breakLoopContinue()
}

private fun implicitReturn() {
    println("Init implicit return")
    listOf(1, 2, 3, 4, 5).forEach {
        if (it == 2) {
            println("Exit implicit return")
            return@forEach
        }
        println(it)
    }
}

private fun inlineReturn() {

    println("Init inline return")
    listOf(1, 2, 3, 4, 5).forEach lit@ {
        if (it == 5) {
            println("Exit inline return")
            return@lit
        }
        println(it)
    }
}

private fun returnBasic(): Unit {
    println("Init Basic return")
    for (i in 0..5) {
        if (i == 5) {
            println("Exit Basic return")
            return
        }
        println(i)
    }

}

private fun breakLoopContinue() {
    println("Init Basic Loop")
    Continue@ for (i in 1..100) {
        for (j in 1..100) {
            if (j === 50) {
                break@Continue
            }
        }
    }
    println("Exit Basic Loop")
}

Result

//returnBasic
Init Basic return
0
1
2
3
4
Exit Basic return

//inlineReturn
Init inline return
1
2
3
4
Exit inline return

//implicitReturn
Init implicit return
1
Exit implicit return
3
4
5

//breakLoopContinue
Init breakLoopContinue Loop
Exit breakLoopContinue Loop

Constructors

Primary

class MyView (ctx: Context): View(ctx) {
   ...
}

Secundary

class MyView : View {
    constructor(ctx: Context) : super(ctx)
    constructor(ctx: Context, attrs: AttributeSet) : super(ctx, attrs)
}

Internal

class MyView internal constructor(ctx: Context) : View (ctx) {
   ...
}

Basics Functions

Main.kt

fun main(args: Array<String>) {
    val numberOperations = NumberOperations()

    twoNumbers(numberOperations)
    twoNumberReverse(numberOperations)
    addTwoNumbersDefault(numberOperations)
    reverseList(numberOperations)
    reverseList2(numberOperations)
    sumLambda(numberOperations)
    sumLambdainFunction(numberOperations)
    sumInlineOperation(numberOperations)
}

private fun sumInlineOperation(numberOperations: NumberOperations) {
    val sumInFunction = numberOperations.sumInFunction(5, 9, { x, y -> x + y })
    println(sumInFunction)
}

private fun sumLambdainFunction(numberOperations: NumberOperations) {
    val _sumLambda: (Int, Int) -> Int = { x, y -> x + y }
    val _sumInFunction = numberOperations.sumInFunction(9, 9, _sumLambda)
    println(_sumInFunction)
}

private fun sumLambda(numberOperations: NumberOperations) {
    val sumLambda = numberOperations.sumLambda(2, 2)
    println(sumLambda)
}

private fun reverseList2(numberOperations: NumberOperations) {
    val reverseList1 = numberOperations.reverseList(listOf(1, 2, 3, 4)).asList()
    println(reverseList1)
}

private fun reverseList(numberOperations: NumberOperations) {
    val reverseList = numberOperations.reverseList(arrayListOf(1, 2, 3)).asList()
    println(reverseList)
}

private fun addTwoNumbersDefault(numberOperations: NumberOperations) {
    val addTwoNumbersDefault = numberOperations.addTwoNumbersDefault(2)
    println(addTwoNumbersDefault)
}

private fun twoNumbers(numberOperations: NumberOperations) {
    val addTwoNumbers = numberOperations.addTwoNumbers(first = 2, second = 5)
    println(addTwoNumbers)
}

private fun twoNumberReverse(numberOperations: NumberOperations) {
    val addTwoNumbers1 = numberOperations.addTwoNumbers(second = 5, first = 2)
    println(addTwoNumbers1)
}

NumberOperations.kt

public class NumberOperations{

    fun addTwoNumbers(first:Int, second :Int) : Int {
        val result = first + second
        return result
    }

    fun addTwoNumbersDefault(first:Int, second :Int = 0) : Int {
        val result = first + second
        return result
    }

    inline fun reverseList<reified T>(list : List<T>) : Array<T> {
        return list.reversed().toTypedArray();
    }
    
    Funciones de Orden Superior y Expresiones Lambda (como en Haskell :D)
   
    val sumLambda : (Int, Int) -> Int = { x,y -> x + y}
   
    fun sumInFunction(x : Int, y : Int, f:(Int, Int) -> Int) : Int {
          return f(x,y)
     }
       
}

Result

5 + 2 = 7
2 + 5 = 7
2 + 0 = 2
[1, 2, 3] = [3, 2, 1]
[1, 2, 3, 4] = [4, 3, 2, 1]
2 + 2 = 4
9 + 9 = 18
5 + 9 = 14

Basic Classes

Main.kt

fun main(args: Array<String>) {
    customerMethod()
    employeeMethod()
}

private fun employeeMethod() {
    val employee = Employee(1221, "Vicboma")
    val toString = employee.toString()
    val id = employee.id
    val name = employee.name

    println("Id : $id  Name: $name")
    println("Employee ToString: $toString")
    println(employee)
}

private fun customerMethod() {
    val customer = Customer(1234)
    customer.doSomething();
    val toString = customer.toString();
    val id = customer.id;
    println("Customer id: $id");
    println("Customer ToString: $toString");
}

Customer.kt

public class Customer(_id : Int) {

    val id = _id;
    //prototype
    var name : String? = ""

    fun doSomething(){
        println("Some code")
    }

    override fun toString() : String
    {
        return ""+this.id;
    }
}

Employee.kt

public class Employee( val id : Int, val name: String ) {
}

Result

Some code
Customer id: 1234
Customer ToString: 1234
Id : 1221  Name: Vicboma
Employee ToString: Employee@4cc77c2e

Data Classes

Main.kt

fun main(args: Array<String>) {
    templateExamples()
}

private fun templateExamples() {
    val customer1 = Customer(1, "victor", "[email protected]")
    val customer2 = Customer(1, "victor", "[email protected]")
    val customer3 = customer1;
    val dataCustomer4 = DataCustomer(1, "victor", "[email protected]")
    val dataCustomer5 = dataCustomer4;

    println(customer1)                    //toString
    println(customer1.hashCode())         //hashCode
    println(customer1.equals(customer2))  //equals()
    println(customer1.equals(customer3))

    //The compiler automatically derives the following members from all properties declared in the primary constructor:
    //equals()/hashCode() pair,
    //toString() of the form "User(name=John, age=42)",
    //componentN() functions corresponding to the properties in their order or declaration,
    //copy() function (see below).
    println(dataCustomer4.equals(dataCustomer5))
    println(dataCustomer4)
}

Customer.kt

public class Customer(val id : Int, val name : String, val email : String) {
}

DataCustomer.kt

/**
 * The primary constructor needs to have at least one parameter;
 * All primary constructor parameters need to be marked as val or var;
 * Data classes cannot be abstract, open, sealed or inner;
 * Data classes may not extend other classes (but may implement interfaces).
 */
data public class DataCustomer(val id : Int, val name : String, val email : String) {
}

Result

Customer@4cc77c2e
1288141870
false
true
true
DataCustomer(id=1, name=victor, [email protected])

Singleton Class

public class Singleton {

    private String b;
    private static Singleton instance;
	
    private Singleton() {
    	System.out.println("This "+this+" is a singleton")
    }
    
    public static Singleton getInstance() {
        if (instance == null) 
            instance = new Singleton();
       
        return instance;
    }
    
    public void setB(String b) { this.b = b;}
    public String getB() { return this.b; }
}

---------
final Singleton first = new Singleton()       
first.setB("hello singleton"=

String second =  new Singleton()       
println(second.getB())      
object Singleton {
    init {
        println("This ($this) is a singleton")
    }
    
    var b:String? = null
}

---------

var first = Singleton       
first.b = "hello singleton"

var second = Singleton
println(second.b)       

Result

This (Singobj@728938a9) is a singleton
hello singleton

Properties

class Rectangle(val height: Int, val width: Int) {
    val isSquare: Boolean
        get() = (height == width)
	set(value) 
            field = value
}

Interface

Main.kt

fun main(args: Array<String>) {
        val z = Z("I am Z")
        val zToString = z.toString()
        println(zToString)
        val zFizz = z.fiz()
        println(zFizz)
        val zBuzz = z.buzz()
        println(zBuzz)  
}

X.kt

interface X{
    fun fiz() : String
}

A.kt

interface A{
  fun buzz() :String
}

Z.kt

open class Z(val arg:String) : A, X  {
   override fun toString() = "ToString() : $arg"
   override fun fiz() : String = "Z - fiz"
   override fun buzz() : String = "Z - buzz"
}

Result

ToString() : I am Z
Z - fiz
Z - buzz

Herencia

Main.kt

fun main(args: Array<String>) {
        val b = B("I am B")
        val bToString = b.toString()
        println(bToString)
        val bFizz = b.fiz()
        println(bFizz)
        val bBuzz = b.buzz()
        println(bBuzz)
        
        val bValue = b.fizBuzz
        println("b.class.toString() $bValue")
            
        val c = C()
        val cToString = c.toString()
        println(cToString)
        val cFizz = c.fiz()
        println(cFizz)
        val cBuzz = c.buzz()
        println(cBuzz)
        val cValue = c.fizBuzz
        println("c.class.toString() $cValue")
        
        val h = H("I am H")
        val hToString = h.toString()
        println(cToString)
        val hFizz = h.fiz()
        println(hFizz)
        val hBuzz = h.buzz()
        println(hBuzz) 
}

X.kt

interface X{
    fun fiz() : String
}

A.kt

interface A{
  fun buzz() :String
}

Z.kt

open class Z(val arg:String) : A, X  {
   override fun toString() = "ToString() : $arg"
   override fun fiz() : String = "Z - fiz"
   override fun buzz() : String = "Z - buzz"
}

B.kt

class B(val name:String) :  Z("Z"), W {  
    override val fizBuzz : Int = 29
    override fun fiz() : String = "B - fiz"
    override fun buzz() : String = "B - buzz"
    override fun toString() : String  = "ToString() : ${this.name} and my parent is ${super.toString()}"  
}

C.kt

class C : Z("I am Z"), W {
    override val fizBuzz : Int = 92
    override fun fiz() : String =  "C - fiz" 
    override fun buzz() : String = "C - buzz"
}

H.kt

class H(val name:String):Z("I am Z") {
      override fun fiz() :String = super.fiz()
      override fun buzz() : String = super.buzz()
}

Result

ToString() : I am B and my parent is ToString() : Z
B - fiz
B - buzz
b.class.toString() 29
ToString() : I am Z
C - fiz
C - buzz
c.class.toString() 92
ToString() : I am Z
Z - fiz
Z - buzz

Extension Function Basics

Main.kt

fun main(args: Array<String>) {
    val str = functionClassic()
    functionInvokeInstance(str)
}

private fun functionInvokeInstance(str: String) {
    val convertSpacesToUnderscoresInvokeInstanceString = str.convertSpacesToUnderscoresInvokeInstanceString()
    println(convertSpacesToUnderscoresInvokeInstanceString)
}

private fun functionClassic(): String {
    val str = "this is my text"
    val convertSpacesToUnderscores = convertSpacesToUnderscores(str);
    println(convertSpacesToUnderscores)
    return str
}


fun convertSpacesToUnderscores(str: String) : String {
    return str.replace(" ","_")
}

fun String.convertSpacesToUnderscoresInvokeInstanceString() : String {
    return this.replace(" ","_")
}

Result

function: this_is_my_text
Invoke Instance String: this_is_my_text

Null Safety

Main.kt

fun main(args: Array<String>) {
    checkingForNullcondition()
    val listMutable = safetyAccess()
    elvisOperator(listMutable)
    safetyCasts()
    specialOperator()
}

private fun specialOperator() {
    val str: String? = null
    val len = str!!.length  //accedemos a la propiedad, pero dará una excepción.
}

private fun safetyCasts() {
    val a: Double = 2.0
    val aInt: Int? = a as? Int
    println(aInt)
}

private fun elvisOperator(listMutable: Array<Int>) {
    val result = listMutable?.size ?: -1
    println(result)
}

//Safe Calls - Any"?".property
private fun safetyAccess(): Array<Int> {
    val listMutable = arrayOf(1, 2, 3, 4)

    val _size = listMutable?.size
    if (listMutable != null && _size > 0)
        println("Array of size $_size")
    else
        println("Empty Array")
    return listMutable
}

private fun checkingForNullcondition() {
    val listImmutable = listOf(1, 2, 3, 4)

    val size = listImmutable.size
    if (listImmutable != null && size > 0)
        println("Array of size $size")
    else
        println("Empty Array")
}

Result

Array of size 4
Array of size 4
4
null
Exception in thread "main" kotlin.KotlinNullPointerException
	at MainNullsafetyOperatorsKt.main(mainNullsafetyOperators.kt:39)

Infix Function

Main.kt

fun main(args: Array<String>) {
    val list = listOf(10, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5)

    doubleResult(list)
    filter(list)
    map(list)
}
//infix without paren + brace
private fun map(list: List<Int>) = list.filter{ it % 2 == 0 }.map{ it - 1 }.forEach{ println(it) }

//infix without Dots & paren + brace
private fun filter(list: List<Int>) = list filter { it % 2 == 0 } forEach {  println(it) }

//infix with paren & brace
private fun doubleResult(list: List<Int>) = list.forEach({ println(it * 2) })

Result

20
-10
-8
-6
-4
-2
0
2
4
6
8
10

10
-4
-2
0
2
4

9
-5
-3
-1
1
3

Reference:

You might also like...
kotlin koans examples
kotlin koans examples

Kotlin Koans Build --- Repo: Getting Started Kotlin --- --- Repo: Problems Kotlin --- --- Repo: GameBoy Emulator Enviroment --- ---

101 examples for Kotlin Programming language.

This is a collection of runnable console applications that highlights the features of Kotlin programming language. The use of console application enab

Full stack examples of how to use Hotwire JS in Kotlin services

hotwire-kt A collection of Kotlin examples using the Hotwire JS framework to build interactive web apps with a Kotlin Armeria server backend. Using Ho

Examples for using Kotlin at a basic level for Android application development.
Examples for using Kotlin at a basic level for Android application development.

Kotlin Android Jetpack Basics Ejemplos para usar Kotlin a nivel básico para el desarrollo de aplicaciones Android. Kotlin Android Jetpack Basics Acerc

A coding examples project about Kotlin Programming language. 🇰
A coding examples project about Kotlin Programming language. 🇰

Kotlin Tutorial 👨🏻‍💻 What is Kotlin ❓ Kotlin is a new programming language, developed by JetBrains. Jetbrains is a popular software development com

Getting started Kotlin - Examples and explanations
Getting started Kotlin - Examples and explanations

Getting started Kotlin I'm learning Kotlin, so I have been updating it with examples and explanations about the language that I'm using at work. Proje

TensorFlow Lite Helper for Android to help getting started with TesnorFlow.

TensorFlow Lite Helper for Android This library helps with getting started with TensorFlow Lite on Android. Inspired by TensorFlow Lite Android image

Getting Started with the URL Shortener project

Getting Started with the URL Shortener project Overall structure The structure of this project is heavily influenced by the clean architecture: A core

Getting Started TheMovieDB Android app
Getting Started TheMovieDB Android app

Getting Started TheMovieDB Android app Android application, created for the test for oddbit. Implements: Room, LiveData, Dependecy Injection (Hilt), R

Spring-graphql-getting-started - Spring for GraphQL provides support for Spring applications built on GraphQL Java

Getting Started with GraphQL and Spring Boot Spring for GraphQL provides support

It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.
It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.

Shutter-Android It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android. What is Shutter? Shutter is an Androi

It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.
It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android.

Shutter-Android It's finally easy to take photos/videos via camera or get photos/videos from gallery on Android. What is Shutter? Shutter is an Androi

This is a template to help you get started building amazing Kotlin applications and libraries.

Welcome to the Starter This is a template to help you get started building amazing Kotlin applications and libraries. Over time, examples will be comp

Forget about bunch of XML files for maintaining UIs. Jetpack Compose is Android’s modern toolkit for building native UI. Here is a small example to get started.
Forget about bunch of XML files for maintaining UIs. Jetpack Compose is Android’s modern toolkit for building native UI. Here is a small example to get started.

Jetpack Compose Sample Description This repository is to get started with new Jetpack Compose Toolkit for Android. By using Jetpack Compose you no nee

KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.
KaMP Kit by Touchlab is a collection of code and tools designed to get your mobile team started quickly with Kotlin Multiplatform.

KaMP Kit Welcome to the KaMP Kit! About Goal The goal of the KaMP Kit is to facilitate your evaluation of Kotlin Multiplatform (aka KMP). It is a coll

A work-in-progress quiz app I started developing for a client but got paused.
A work-in-progress quiz app I started developing for a client but got paused.

quiz-app A work-in-progress quiz app I started developing for a client but got paused. Background This app was intended to be a trivia app where users

Example mod with Mixin to help you to get started with creating a mod with mixins.

ExampleMixinMod Example mod with Mixin to help you to get started with creating a mod with mixins. For usage of mixins, see here. Also, remember to tu

A set of highly-opinionated, batteries-included gradle plugins to get you started building delicious multi-module Kotlin projects

Sourdough Gradle What is Sourdough Gradle? Sourdough is a set of highly opinionated gradle plugins that aim to act as the starter for your Kotlin proj

This is a skeleton project for Zircon users that can be used to get started with Zircon.
This is a skeleton project for Zircon users that can be used to get started with Zircon.

Zircon Kotlin Skeleton Project This is a skeleton project for Zircon users that can be used to get started with Zircon. Getting started This project w

Comments
  • Bump junit from 4.11 to 4.13.1

    Bump junit from 4.11 to 4.13.1

    Bumps junit from 4.11 to 4.13.1.

    Release notes

    Sourced from junit's releases.

    JUnit 4.13.1

    Please refer to the release notes for details.

    JUnit 4.13

    Please refer to the release notes for details.

    JUnit 4.13 RC 2

    Please refer to the release notes for details.

    JUnit 4.13 RC 1

    Please refer to the release notes for details.

    JUnit 4.13 Beta 3

    Please refer to the release notes for details.

    JUnit 4.13 Beta 2

    Please refer to the release notes for details.

    JUnit 4.13 Beta 1

    Please refer to the release notes for details.

    JUnit 4.12

    Please refer to the release notes for details.

    JUnit 4.12 Beta 3

    Please refer to the release notes for details.

    JUnit 4.12 Beta 2

    No release notes provided.

    JUnit 4.12 Beta 1

    No release notes provided.

    Commits
    • 1b683f4 [maven-release-plugin] prepare release r4.13.1
    • ce6ce3a Draft 4.13.1 release notes
    • c29dd82 Change version to 4.13.1-SNAPSHOT
    • 1d17486 Add a link to assertThrows in exception testing
    • 543905d Use separate line for annotation in Javadoc
    • 510e906 Add sub headlines to class Javadoc
    • 610155b Merge pull request from GHSA-269g-pwp5-87pp
    • b6cfd1e Explicitly wrap float parameter for consistency (#1671)
    • a5d205c Fix GitHub link in FAQ (#1672)
    • 3a5c6b4 Deprecated since jdk9 replacing constructor instance of Double and Float (#1660)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
  • Bump kotlin-stdlib from 1.3.0-rc-198 to 1.6.0-M1

    Bump kotlin-stdlib from 1.3.0-rc-198 to 1.6.0-M1

    Bumps kotlin-stdlib from 1.3.0-rc-198 to 1.6.0-M1.

    Release notes

    Sourced from kotlin-stdlib's releases.

    Kotlin 1.6.0-M1

    Learn how to install Kotlin 1.6.0-M1.

    Changelog

    Android

    • KT-48019 Bundle Kotlin Tooling Metadata into apk artifacts
    • KT-47733 JVM / IR: Android Synthetic don't generate _findCachedViewById function

    Compiler

    New Features

    • KT-12794 Allow runtime retention repeatable annotations when compiling under Java 8
    • KT-47984 In-place arguments inlining for @​InlineOnly functions
    • KT-48194 Try to resolve calls where we don't have enough type information, using the builder inference despite the presence of the annotation
    • KT-26245 Add ability to specify generic type parameters as not-null
    • KT-45949 Kotlin/Native: Improve bound check elimination
    • KT-47699 Support programmatic creation of class annotations and corresponding feature flag on JVM
    • KT-47736 Support conversion from regular functional types to suspending ones in JVM IR
    • KT-39055 Support property delegate created via synthetic method instead of field

    Performance Improvements

    • KT-33835 Bytecode including unnecessary null checks for safe calls where left-hand side is non-nullable
    • KT-41510 Compilation of kotlin html DSL is still too slow
    • KT-48211 We spend a lot of time in ExpectActual declaration checker when there is very small amount of actual/expect declaration
    • KT-39054 Optimize delegated properties which call get/set on the given KProperty instance on JVM
    • KT-47918 JVM / IR: Performance degradation with const-bound for-cycles
    • KT-47785 Compilation time increased when trying to compile AssertJ DB expression in 1.5.21
    • KT-46615 Don't generate nullability assertions in methods for directly invoked lambdas

    Fixes

    • KT-48523 Kotlin/Native: cross-compilation from Linux to MinGW not working when platform.posix is used
    • KT-48295 JVM / IR: VerifyError: Bad access to protected data in getfield
    • KT-48440 JVM IR: Missing checkcast in generated bytecode causes VerifyError in Kotlin 1.5.30
    • KT-48794 Breaking change in 1.5.30: Builder inference lambda contains inapplicable calls so {1} cant be inferred
    • KT-48653 Warnings on non-exhaustive when statements missing in some cases with 1.6
    • KT-48394 JVM: Invalid locals caused by unboxing bytecode optimization
    • KT-48380 kotlin.RuntimeException: Unexpected receiver type
    • KT-47855 Kotlin/Native: compilation fails due to Escape Analysis
    • KT-48291 False positive [ACTUAL_MISSING] Declaration must be marked with 'actual' when implementing actual interface
    • KT-48613 Kotlin/Native fails to compile debug binaries for watchosArm64 target
    • KT-48618 Enable by default "suspend conversion" feature in 1.6
    • KT-48543 Native compiler crashes because of bridges for $default stubs
    • KT-47328 JVM / IR: NoSuchFieldError with missing CHECKCAST
    • KT-47638 Drop EXPERIMENTAL_IS_NOT_ENABLED diagnostic

    ... (truncated)

    Changelog

    Sourced from kotlin-stdlib's changelog.

    1.6.0-M1

    Android

    • KT-48019 Bundle Kotlin Tooling Metadata into apk artifacts
    • KT-47733 JVM / IR: Android Synthetic don't generate _findCachedViewById function

    Compiler

    New Features

    • KT-12794 Allow runtime retention repeatable annotations when compiling under Java 8
    • KT-47984 In-place arguments inlining for @​InlineOnly functions
    • KT-48194 Try to resolve calls where we don't have enough type information, using the builder inference despite the presence of the annotation
    • KT-26245 Add ability to specify generic type parameters as not-null
    • KT-45949 Kotlin/Native: Improve bound check elimination
    • KT-47699 Support programmatic creation of class annotations and corresponding feature flag on JVM
    • KT-47736 Support conversion from regular functional types to suspending ones in JVM IR
    • KT-39055 Support property delegate created via synthetic method instead of field

    Performance Improvements

    • KT-33835 Bytecode including unnecessary null checks for safe calls where left-hand side is non-nullable
    • KT-41510 Compilation of kotlin html DSL is still too slow
    • KT-48211 We spend a lot of time in ExpectActual declaration checker when there is very small amount of actual/expect declaration
    • KT-39054 Optimize delegated properties which call get/set on the given KProperty instance on JVM
    • KT-47918 JVM / IR: Performance degradation with const-bound for-cycles
    • KT-47785 Compilation time increased when trying to compile AssertJ DB expression in 1.5.21
    • KT-46615 Don't generate nullability assertions in methods for directly invoked lambdas

    Fixes

    • KT-48523 Kotlin/Native: cross-compilation from Linux to MinGW not working when platform.posix is used
    • KT-48295 JVM / IR: VerifyError: Bad access to protected data in getfield
    • KT-48440 JVM IR: Missing checkcast in generated bytecode causes VerifyError in Kotlin 1.5.30
    • KT-48794 Breaking change in 1.5.30: Builder inference lambda contains inapplicable calls so {1} cant be inferred
    • KT-48653 Warnings on non-exhaustive when statements missing in some cases with 1.6
    • KT-48394 JVM: Invalid locals caused by unboxing bytecode optimization
    • KT-48380 kotlin.RuntimeException: Unexpected receiver type
    • KT-47855 Kotlin/Native: compilation fails due to Escape Analysis
    • KT-48291 False positive [ACTUAL_MISSING] Declaration must be marked with 'actual' when implementing actual interface
    • KT-48613 Kotlin/Native fails to compile debug binaries for watchosArm64 target
    • KT-48618 Enable by default "suspend conversion" feature in 1.6
    • KT-48543 Native compiler crashes because of bridges for $default stubs
    • KT-47328 JVM / IR: NoSuchFieldError with missing CHECKCAST
    • KT-47638 Drop EXPERIMENTAL_IS_NOT_ENABLED diagnostic
    • KT-48349 OptIn markers are forbidden on local variable / value parameter / property getter only in presence of explicit Target annotation
    • KT-48589 KotlinTypeRefiner is lost, leading to TYPE_MISMATCH and OVERLOAD_RESOLUTION_AMBIGUITY issues with MPP projects
    • KT-48615 Inconsistent behavior with integer literals overflow (Implementation)
    • KT-47937 Implement deprecation of computing constant values of complex boolean expressions in when condition branches and conditions of loops

    ... (truncated)

    Commits
    • 3f1c3ea Build: Add missing verification metadata for httpcore 4.2.1
    • 60d02ea Add changelog for 1.6.0-M1 and move 1.5.x changelogs to a separate file
    • dce8aee Add changelog for 1.5.31
    • 71a4ede Add changelog for 1.5.30
    • 6446866 Minor. Ignore test on JS_IR
    • 102736f Fixup end label of local variable if it is before start label
    • b07cf8a Bump Kotlin/Native version.
    • e575c94 Fix binary compatibility with AS Arctic Fox C14
    • 7613d80 Provide KotlinSourceElementKt.getPsi for bwc with AS
    • 15b0e11 [Native][Tools] Add input directory in the bundles repack script
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Owner
Victor Bolinches
I build things in software, sometimes with a lot of craziness. Game/Tooling programmer. Twitter - @vicboma1
Victor Bolinches
Getting Started with the URL Shortener project

Getting Started with the URL Shortener project Overall structure The structure of this project is heavily influenced by the clean architecture: A core

null 0 Nov 8, 2021
Spring-graphql-getting-started - Spring for GraphQL provides support for Spring applications built on GraphQL Java

Getting Started with GraphQL and Spring Boot Spring for GraphQL provides support

Shinya 0 Feb 2, 2022
This is a template to help you get started building amazing Kotlin applications and libraries.

Welcome to the Starter This is a template to help you get started building amazing Kotlin applications and libraries. Over time, examples will be comp

Backbone 8 Nov 4, 2022
This is a skeleton project for Zircon users that can be used to get started with Zircon.

Zircon Kotlin Skeleton Project This is a skeleton project for Zircon users that can be used to get started with Zircon. Getting started This project w

Vladislav Kashchey 0 May 3, 2022
📦📦Video downloader for Android - Download videos from Youtube, Facebook, Twitter, Instagram, Dailymotion, Vimeo and more than 1000 other sites

youtube-dl-android ?? An Android client for youtube-dl: https://github.com/rg3/youtube-dl Major technologies Language: Kotlin Architecture: MVVM Andro

Cuong Pham 443 Dec 30, 2022
An Online Meme Sharing app with swipeable vidoes, user can like, share different videos, each viewpager item has one video to show.

MemesSharing An Online Meme Sharing app with swipeable vidoes, user can like, share different videos, each viewpager item has one video to show. 1. Fl

Vikas Bajpayee 13 Aug 6, 2022
Solution code for Android Kotlin Fundamentals Codelab 8.1 Getting data from the internet

MarsRealEstateNetwork - Solution Code Solution code for Android Kotlin Fundamentals Codelab 8.1 Getting data from the internet Introduction MarsRealEs

DavidHieselmayr 1 Apr 7, 2022
It is a project that contains lessons and examples about Kotlin programming language. 🇰

Kotlin Tutorials What is Kotlin? I added the platforms it supports and great resources. You can access the article from the link below: https://medium

Halil Özel 94 Dec 22, 2022
Kotlin Examples Problems

Kotlin Examples Problems --->>> Repo: Getting Started Kotlin <<<--- --->>> Repo Kotlin Koans <<<--- --->>> Repo: GameBoy Emulator Enviroment <<<--- --

Victor Bolinches 22 Oct 3, 2022
Kotlin Unit Testing Examples

Kotlin Unit Testing Examples Table of Contents Application Gradle, Kotlin & Groovy Junit4 Junit5 KotlinTest Spek Mockito Mockito-Kotlin Mockk Strikt T

Jarosław 110 Dec 11, 2022