Range<T extends Comparable<Object?>> class sealed

A Range represents a convex (contiguous) portion of a domain.

T is expected to be immutable. If T is mutable, the value produced by Comparable.compare must not change when used in a Range. Doing so will result in undefined behaviour.

See:

  • Unbound for a range that is unbound on both ends.
  • Min and Max for a range that is bound on one end.
  • Interval for a range that is bound on both ends.
Implementers

Constructors

Range()
Creates a Range.
const

Properties

empty bool
Return true if this is empty, i.e. [a..a).
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

besides(Range<T> other) bool
Returns true if an empty range exists between this and other.
contains(T value) bool
Returns true if this contains value.
containsAll(Iterable<T> values) bool
Returns true if this contains all values.
encloses(Range<T> other) bool
Returns true if other's bounds do not extend outside this bounds.
gap(Range<T> other) Interval<T>?
If this does not intersect other, returns the gap in between. Otherwise returns null.
intersection(Range<T> other) Range<T>?
If this intersects other, returns the intersection. Otherwise returns null.
intersects(Range<T> other) bool
Returns true if a non-empty range exists between this and other.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited