delblanco
listOf(A,B,C)
A to B, A to C, B to C
val users = listOf(User("A"), User("B"), User("C")) val chats = users.flatMap{ u1 -> users.filterNot { u1 == it } .map { u2 -> Chat(setOf(u1, u2)) } }.toSet() // filters out duplicates
bjonnh
val l = listOf("A", "B", "C", "D") l.flatMapIndexed { i, a -> l.subList(i+1, l.size).map { setOf(a,it) } }
filterNot
toSet
A modern programming language that makes developers happier.