Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sajjadyousefnia/daa8607208a1326d2b37a5f9f3809a74 to your computer and use it in GitHub Desktop.
Save sajjadyousefnia/daa8607208a1326d2b37a5f9f3809a74 to your computer and use it in GitHub Desktop.
val stringList: List<String> = listOf("in", "the", "club")
print(stringList.last()) // will print "club"
// given a predicate
print(stringList.last{ it.length == 3}) // will print "the"
val intSet: Set<Int> = setOf(3, 5, 6, 6, 6, 3)
print(intSet.last()) // will print 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment