Dron Bhattacharya
02/23/2023, 6:39 PMclass TList(vararg task: Task) {
private val tasks: MutableList<Task>
init {
tasks = mutableListOf<Task>(*task)
}
fun add(t: Task) = tasks.add(t)
fun remove(t: Task) = tasks.remove(t)
fun search(id: Int) = tasks.first { it -> it.id == id }
}
Chris Lee
02/23/2023, 6:41 PMDron Bhattacharya
02/23/2023, 6:43 PMChris Lee
02/23/2023, 6:45 PMDron Bhattacharya
02/23/2023, 6:46 PMDron Bhattacharya
02/23/2023, 7:13 PMby
in the code that I have written?Chris Lee
02/23/2023, 7:16 PMclass TList(vararg task: String) {
private val tasks: MutableList<String>
init {
tasks = mutableListOf<String>(*task)
}
fun add(t: String) = tasks.add(t)
fun remove(t: String) = tasks.remove(t)
fun search(id: String) = tasks.first { it -> it == id }
}
class TList2(someList : List<String>) : List<String> by someList {
}
Dron Bhattacharya
02/23/2023, 7:21 PMDron Bhattacharya
02/23/2023, 7:22 PMby
and still, limit the available methods?Chris Lee
02/23/2023, 7:26 PMDron Bhattacharya
02/23/2023, 7:27 PM