``` fun main(args: Array<String>) { val ...
# getting-started
v
Copy code
fun main(args: Array<String>) {
    val map = HashMap<Int, Int>()
    fun plusOne(i: Int): Int = i + 1
    arrayOf(1, 2, 3)
            .map { Pair(map[it], it) }
            .filter { it.first != null }
            .map { plusOne(it.first) }
}
I am invoking some Java code from kotlin, and I'm getting a null warning even though the result cannot be null. How do I avoid getting a null-pointer warning on
plusOne(it)
? Do I have to explicitly tell Kotlin that it cannot be null or is there a better way?