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

differenceAll

fun differenceAll(elements: Collection<ClosedRange<T>>): RangeSet<T> (source)

Creates a new RangeSet containing values not present in this set within the specified ranges.

Examples:

assert(IntRangeSet(listOf(3..7, 12..16, 22..27, 29..32)).differenceAll(listOf()).isEmpty()
assert(IntRangeSet(listOf(3..7, 12..16, 22..27, 29..32)).differenceAll(listOf(5..14, 26..30)).toList() == listOf(8..11, 28..28)
assert(IntRangeSet(listOf(3..7, 12..16, 22..27, 29..32)).differenceAll(listOf(1..35)).toList() == listOf(1..2, 8..11, 17..21, 28..28, 33..35)


Return
new set containing values not present in this set within the specified range