It's possible to take the first approach of findin...
# stdlib
i
It's possible to take the first approach of finding whether there is at least one duplicate and extend it to yield a sequence of all duplicate values:
Copy code
buildSequence {
        val uniques = mutableSetOf<Int>()
        list.forEach { if (!uniques.add(it)) yield(it) }
}.distinct()