Range

open class Range(var lower: Int, var upper: Int)

Continuous interval in a one-dimensional coordinate system expressed as a lower bound an an upper bound, inclusive.

Constructors

Link copied to clipboard
constructor(lower: Int, upper: Int)
constructor()

Constructs an empty range with lower and upper both zero.

constructor(range: Range)

Constructs a range with the lower bound and upper bound of a specified range.

Properties

Link copied to clipboard

Indicates whether or not this range is empty. An range is empty when its lower bound is greater than or equal to its upper bound.

Link copied to clipboard
val length: Int

Returns the length of the interval between this range's lower bound and upper bound, or 0 if this range is empty.

Link copied to clipboard
var lower: Int

The range's lower bound, inclusive.

Link copied to clipboard
var upper: Int

The range's upper bound, inclusive.

Functions

Link copied to clipboard
fun copy(range: Range): Range

Sets this range to the lower bound and upper bound of a specified range.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun set(lower: Int, upper: Int): Range

Sets this range to the specified lower bound and upper bound.

Link copied to clipboard

Sets this range to an empty range.

Link copied to clipboard
open override fun toString(): String