Answers for "sort custom arraylist in kotlin"

1

sort custom object list in kotlin

val messages = mutableListOf<Message>(
                Message(from = "Tonnie", messageString = "Hi", timestamp = Date()),
                Message(from = "Victoria", messageString = "Miss You", timestamp = Date()))
                 messages.sortWith(compareBy { it.timestamp })
Posted by: Guest on October-24-2020

Browse Popular Code Answers by Language