[ad_1]
I have a class that as a parameter get value with numbers. And inside that class I have a list that suppose to add those numbers every time instance of that class been created. How to make it work in Kotlin?
class MyClass internal constructor(
private val number: Int
){
private val listOfNumbers = mutableListOf<Int>()
init {
listOfNumbers.add(number)// So here it suppose to add all numbers
}
Or maybe there is a better approach?
[ad_2]