public inline fun <T> List<T>.elementAtOrNull(index: Int): T? {
return this.getOrNull(index)
}
public fun <T> List<T>.getOrNull(index: Int): T? {
return if (index >= 0 && index <= lastIndex) get(index) else null
}
val list = listOf(1, 2, 3, 4, 5)
println(list.elementAtOrNull(2)) // 3
println(list.elementAtOrNull(10)) // null