Thread
#feed
    Burkhard

    Burkhard

    3 years ago
    great article, just one small correction: You state that
    null
    has no type, but it’s type is
    Nothing?
    . You mention that later by saying that
    Nothing?
    as a return type forces you to return
    null
    . You can also verify this with this code
    val foo = null
    println(::foo)
    nfrankel

    nfrankel

    3 years ago
    thanks! but i’m not the author 😅
    b

    bdawg.io

    3 years ago
    Another thing I noticed is in this snippet:
    //Java
    public static Consumer<Integer> printNum = x -> System.out.println("Num " + x);
    
    //Kotlin
    fun callMe(block: (Int) -> Unit): Unit = (1..100).forEach(block)
    
    fun main(){
        callMe { Lambdas.printNum } //it works fine
    }
    nothing would happen because he's not actually passing in the function (and as far as I understand it won't compile). I believe the following was actually meant
    callMe(Lambdas::printNum) // it works fine