Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // try to add item and tell it's projected as <out Any?>
- // show it's possible using type parameter also
- fun printItems(items: MutableList<*>) {
- for(i in items.indices){
- println(items.get(i))
- }
- }
- fun main(){
- val x: MutableList<Any> = mutableListOf(1,2,"a")
- printItems(x)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement