I have case where i need to find all duplicates in...
# announcements
a
I have case where i need to find all duplicates in list by code and finally get values from duplicateList with lower dateTime. Any ideas?
Copy code
fun main() {
      val fileList = listOf<FileName>()
}

data class FileName(val code: String, val uid: String, val dateTime: LocalDateTime)
d
a
I need to do the opposite, get only duplicate codes 🙂
d
Copy code
list.groupingBy { it.key }
  .eachCount()
  .filterValues { it > 1 }
👍 1
that gives you all the duplicate keys as keys in the map. You can do
.keys
if you need them as a separate collection
a
yes that's exactly what i want! Thx