You are currently viewing Allow function to take in different types of collections of collection?

Allow function to take in different types of collections of collection?

How can i make a function take in the collections Array, List and MutableList without overloading the function. i tried using the Collection type like the code below because i thought this was the base class for all collections but this doesnt seem to work.

fun doStuffWithCollection(collection: Collection) { Var collectionAsArray = collection.toTypedArray blablabla….. }

submitted by /u/Savings_Garlic5498
[link] [comments]