Add *Range.isEmpty(), *Progression.isEmpty()
This commit is contained in:
@@ -71,6 +71,8 @@ class GenerateProgressions(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
override fun iterator(): ${t}Iterator = ${t}ProgressionIterator(start, end, increment)
|
||||
|
||||
public fun isEmpty(): Boolean = if (increment > 0) start > end else start < end
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is $progression && ${compare("start")} && ${compare("end")} && ${compare("increment")}
|
||||
|
||||
|
||||
@@ -66,6 +66,8 @@ class GenerateRanges(out: PrintWriter) : BuiltInsSourceGenerator(out) {
|
||||
|
||||
override fun iterator(): ${t}Iterator = ${t}ProgressionIterator(start, end, $increment)
|
||||
|
||||
override fun isEmpty(): Boolean = start > end
|
||||
|
||||
override fun equals(other: Any?): Boolean =
|
||||
other is $range && ${compare("start")} && ${compare("end")}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user