Access Collection Elements

var companies = setOf("Facebook", "Apple", "Netflix", "Google")
println(companies.elementAt(3))
// Prints: Google
println(companies.elementAt(4))
// Returns and Error
println(companies.elementAtOrNull(4))
// Prints: null
Comments