Created
February 13, 2020 09:44
-
-
Save joansanfeliu/3953fa3727bf8476232c72a6b382ac72 to your computer and use it in GitHub Desktop.
Kotlin List with multiple types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val list: MutableList<Comparable<*>> = ArrayList() | |
list.add("Hello") | |
list.add(1) | |
println(list.toString()) | |
// prints [Hello, 1] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment