forEachIndexed

inline fun forEachIndexed(action: (i: Long, it: Boolean) -> Unit)(source)

Iterates over each bit in the BitSet and invokes the provided action for every index and corresponding bit value.

Deliberatelly not an extension function, to have precedence over the int-indexed forEach function of the Iterable interface.

Parameters

action

A lambda function that is invoked with two arguments:

  • i: The index of the bit in the BitSet.

  • it: The value of the bit at the given index, either true or false.