<How to check if a (constrained once) sequence is ...
# stackoverflow
r
How to check if a (constrained once) sequence is empty in Kotlin How do I check if a sequence is (not) empty, without assuming it can be consumed twice? In most cases values.any() and values.none() would work (see also here): fun doSomething(values: Sequence) { if (values.any()) { println("We have these values: " + values.joinToString(", ")) } else { println("We have no values") } } but this fails if the sequence can only be...