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

add

open fun add(element: ClosedRange<T>): Boolean (source)

Adds range of values to the set; addition set logic.

Examples:

assert(IntRangeSet(listOf(7..11)).apply { add(3..5) }.toList() == listOf(3..5, 7..11))
assert(IntRangeSet(listOf(5..11)).apply { add(7..10) }.toList() == listOf(5..11))
assert(IntRangeSet(listOf(5..8, 11..16)).apply { add(7..10) }.toList() == listOf(5..16))


Parameters

element - range of values to add

Return
whether any values were added