kotlin-range-sets / com.github.jonpeterson.kotlin.ranges / RangeSet / removeAll

removeAll

open fun removeAll(elements: Collection<ClosedRange<T>>): Boolean (source)

Removes ranges of values from the set; subtraction set logic.

Examples:

assert(IntRangeSet(listOf(5..21)).apply { removeAll(listOf(7..15, 12..17, 20..20)) }.toList() == listOf(5..6, 18..19, 21..21))
assert(IntRangeSet(listOf(5..9, 13..21)).apply { removeAll(listOf(7..15, 19..23)) }.toList() == listOf(5..6, 16..18))


Parameters

elements - ranges of values to remove

Return
whether any values were removed