I have list of three set of values which are related to each other. i.e. Roll Number, Student Name and School Name.
I am using Kotlin Triple to store them. Below is the code:
val studentData = listOf(
Triple(first = "1", second ="Sam", third = "MIT"),
Triple(first = "2", second ="Johnny", third = "SYM"),
Triple(first = "3", second ="Depp", third = "PIT")
)
And now I need to build a function which will accept roll number and will return either student name or school name. Something like below:
fun getStudentDetails(rollNumber: String) : String {
//...
//return student name or school name
}
How to achieve this?
How to traverse the Triple in most preformat way considering below:
a) the time and space complexity
b) the list of student details can grow large