hooliooo
03/11/2020, 11:07 AMlistOf(A, B, C)
I want a way to compare A to B, B to C and A to C so they are all evaluated against each othersteveme
03/11/2020, 11:36 AMval list = listOf("a", "b", "c")
list.forEach { fst -> list.forEach { snd -> println("$fst,$snd") } }
Samme Kleijn
03/11/2020, 1:02 PMval list = listOf(A, B, C)
val isEqual = list.all { it == list.first() }
But I doubt this is what you are looking for, could you give me an example of what you expect?Jakub Pi
03/12/2020, 3:38 AMval list = listOf(A, B, C)
(list + list.first()).zipWithNext().map { (a, b) -> a == b }
This matches the original request, but if you have 4 elements you will only get 4 comparisons, not the cross product (e.g. A==C and B==D would never run)vineethraj49
03/12/2020, 10:09 AMhooliooo
03/12/2020, 1:17 PMval elementsToDrop = myList.indexOf(zone)
val subsequence = myList.drop(elementsToDrop + 1)
if (subsequence.isEmpty()) return@map true
....