I have two list, with the same no of items
List1 {id, timestamp} - Different dataClass
List2 {id, name, designation, profileimage} - different Dataclass
I need to order List2, in the order it's id's appear in List1? How can I achieve this?
I tried the below but got the following error on for
{ List3[it.getUID()] }
"Type inference failed. The value of the type parameter K should be mentioned in input types (argument types, receiver type or expected type). Try to specify it explicitly."
val List3 = List1!!.withIndex().associate { it.value to it.index }
val List4 = (List2 as ArrayList<Users>).sortedBy { List3[it.getUID()] }