// Created on savesnippets.com · https://savesnippets.com/12AWAiRK7CagVa fun sizeOf(any: Collection<*>): Int = any.size fun firstOrNullAny(any: List<*>): Any? = any.firstOrNull() fun main() { // Accepts any list, but treats elements as Any? val ints = listOf(1, 2, 3) val strs = listOf("a", "b") println(sizeOf(ints)) // 3 println(sizeOf(strs)) // 2 // Use case: a method on Any that wants to enumerate without knowing T fun printSample(items: List<*>) { println(items.take(3)) // List<*> → Any? when read } printSample(ints) printSample(strs) // Generally prefer a typed parameter — star projection is for when you // truly only need read-only access and don't care about the type. }