06/25/2022, 6:51 PM
Efficient way to create like 1000 instance of a class As a newbie in Kotlin, i want to ask a question. Let’s say that i have class Dog like below, data class Dog(val breed : String, val gender : String, val name : String, val age: Int){} I want to make 1000 instances of this Dog class and add all of instances in an arrayList and later i will use this list in different activities. Imagine that I have an activity which only shows Labradors . So i have to take that arrayList which contains all of my Dogs and filter the breed according to Labrador...