DiscreteRange<CTYPE extends Comparable<CTYPE > , ITYPE extends CTYPE > class
abstract
Inheritance
Mixed-in types
Implementers
Constructors
DiscreteRange.new (CTYPE? start , CTYPE? end , {bool startInclusive = true , bool endInclusive = false })
Creates a new discrete range with the given start and end values and inclusion flags.
Properties
endInclusive
→ bool
no setter inherited
first
→ ITYPE
The first element.
no setter inherited
hashCode
→ int
The hash code for this object.
no setter inherited
isEmpty
→ bool
Whether this collection has no elements.
no setter inherited
isNotEmpty
→ bool
Whether this collection has at least one element.
no setter inherited
iterator
→ Iterator <ITYPE >
Returns an iterator over the elements in this range.
Throws an exception if the range is not discrete or is infinite.
no setter override
last
→ ITYPE
The last element.
no setter inherited
length
→ int
The number of elements in this Iterable .
no setter inherited
runtimeType
→ Type
A representation of the runtime type of the object.
no setter inherited
single
→ ITYPE
Checks that this iterable has only one element, and returns that element.
no setter inherited
startInclusive
→ bool
no setter inherited
Methods
any (bool test (ITYPE element ) )
→ bool
Checks whether any element of this iterable satisfies test
.
inherited
cast <R > ()
→ Iterable <R >
A view of this iterable as an iterable of R
instances.
inherited
compareTo (Range <Comparable > other )
→ int
Compares this range to another range. First compare starts of the ranges. If start
of this range is less than the start of the other, return -1, if it's greater, return 1.
If both starts are equal, compare ends of the ranges.
inherited
contains (Object ? obj )
→ bool
Detect whether this range contains an element.
override
elementAt (int index )
→ ITYPE
Returns the index
th element.
inherited
end ({bool ? inclusive })
→ CTYPE?
If inclusive
is provided and differs from the current end inclusion,
the end value is adjusted to the next or previous value accordingly.
override
every (bool test (ITYPE element ) )
→ bool
Checks whether every element of this iterable satisfies test
.
inherited
except (Range <CTYPE > that )
→ List <Range <CTYPE > >
The difference between two ranges is the set of all elements that are in this range but not in the other range.
inherited
expand <T > (Iterable <T > toElements (ITYPE element ) )
→ Iterable <T >
Expands each element of this Iterable into zero or more elements.
inherited
firstWhere (bool test (ITYPE element ), {ITYPE orElse ()? })
→ ITYPE
The first element that satisfies the given predicate test
.
inherited
fold <T > (T initialValue , T combine (T previousValue , ITYPE element ) )
→ T
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
followedBy (Iterable <ITYPE > other )
→ Iterable <ITYPE >
Creates the lazy concatenation of this iterable and other
.
inherited
forEach (void action (ITYPE element ) )
→ void
Invokes action
on each element of this iterable in iteration order.
inherited
intersect (Range <CTYPE > that )
→ Range <CTYPE > ?
The intersection of two ranges is the set of all elements that are in both ranges.
inherited
isAdjacentTo (Range <CTYPE > that )
→ bool
Test whether this range is adjacent to another range. The ranges are adjacent
if the end of this range is the same as the start of the other range or vice versa.
inherited
isSubsetOf (Range <CTYPE > that , {bool strict = false })
→ bool
Evaluate whether this range is a subset of another.
inherited
isSupersetOf (Range <CTYPE > that , {bool strict = false })
→ bool
Evaluate whether this range is a superset of another.
inherited
join ([String separator = "" ])
→ String
Converts each element to a String and concatenates the strings.
inherited
lastWhere (bool test (ITYPE element ), {ITYPE orElse ()? })
→ ITYPE
The last element that satisfies the given predicate test
.
inherited
map <T > (T toElement (ITYPE e ) )
→ Iterable <T >
The current elements of this iterable modified by toElement
.
inherited
newInstance ()
→ Range <CTYPE >
inherited
noSuchMethod (Invocation invocation )
→ dynamic
Invoked when a nonexistent method or property is accessed.
inherited
overlaps (Range <CTYPE > that )
→ bool
Check whether this range overlaps with another range.
inherited
reduce (ITYPE combine (ITYPE value , ITYPE element ) )
→ ITYPE
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
singleWhere (bool test (ITYPE element ), {ITYPE orElse ()? })
→ ITYPE
The single element that satisfies test
.
inherited
skip (int count )
→ Iterable <ITYPE >
Creates an Iterable that provides all but the first count
elements.
inherited
skipWhile (bool test (ITYPE value ) )
→ Iterable <ITYPE >
Creates an Iterable
that skips leading elements while test
is satisfied.
inherited
start ({bool ? inclusive })
→ CTYPE?
If inclusive
is provided and differs from the current start inclusion,
the start value is adjusted to the next or previous value accordingly.
override
take (int count )
→ Iterable <ITYPE >
Creates a lazy iterable of the count
first elements of this iterable.
inherited
takeWhile (bool test (ITYPE value ) )
→ Iterable <ITYPE >
Creates a lazy iterable of the leading elements satisfying test
.
inherited
toList ({bool growable = true })
→ List <ITYPE >
Creates a List containing the elements of this Iterable .
inherited
toSet ()
→ Set <ITYPE >
Creates a Set containing the same elements as this iterable.
inherited
toString ()
→ String
A string representation of this object.
override
union (Range <CTYPE > that )
→ List <Range <CTYPE > >
The union of two ranges is the set of all elements that are in either range.
inherited
where (bool test (ITYPE element ) )
→ Iterable <ITYPE >
Creates a new lazy Iterable with all elements that satisfy the
predicate test
.
inherited
whereType <T > ()
→ Iterable <T >
Creates a new lazy Iterable with all elements that have type T
.
inherited
Operators
operator * (Range <CTYPE > that )
→ Range <CTYPE > ?
Operator for the intersection of this range and another range.
inherited
operator + (Range <CTYPE > that )
→ List <Range <CTYPE > >
Operator for the union of this range and another range.
inherited
operator - (Range <CTYPE > that )
→ List <Range <CTYPE > >
Operator for the difference between this range and another range.
inherited
operator == (Object that )
→ bool
Ranges are equal if they have same start and end dates and inclusions.
inherited