Represents the range of totally ordered, ordinal values
generated by two endpoints of type Ordinal
and
Comparable
. If the first value is smaller than the
last value, the range is increasing. If the first value
is larger than the last value, the range is decreasing.
If the two values are equal, the range contains exactly
one element. The range is always nonempty, containing
at least one value.
A range may be produced using the ..
operator:
for (i in min..max) { ... } if (char in 'A'..'Z') { ... }
Initializer |
Range(Element first, Element last) Parameters:
|
Attributes | |
clone | Source Code Returns the range itself, since ranges are immutable. Refined declaration: clone |
coalesced | Source Code Returns the range itself, since a Range cannot contain nulls. Refined declaration: coalesced |
decreasing | Source Code shared Boolean decreasing Determines if the range is decreasing. |
first | Source Code shared actual Element first The start of the range. Refined declaration: first |
last | Source Code shared actual Element last The end of the range. Refined declaration: last |
lastIndex | Source Code shared actual Integer lastIndex The index of the end of the range. Refined declaration: lastIndex |
rest | Source Code The rest of the range, without the start of the range. Refined declaration: rest |
reversed | Source Code Reverse this range, returning a new range. Refined declaration: reversed |
sequence | Source Code Returns this range. Refined declaration: sequence |
size | Source Code shared actual Integer size The nonzero number of elements in the range. Refined declaration: size |
string | Source Code shared actual String string A developer-friendly string representing the
instance. Concatenates the name of the concrete
class of the instance with the Refined declaration: string |
Inherited Attributes |
Attributes inherited from: Object |
Attributes inherited from: Cloneable<Clone> |
Attributes inherited from: Collection<Element> |
Attributes inherited from: Correspondence<Key,Item> |
Attributes inherited from: Iterable<Element,Absent> |
Attributes inherited from: List<Element> |
Attributes inherited from: [Element+] |
Attributes inherited from: Element[] |
Methods | |
by | Source Code Produce an (0..10).by(3) results in an iterable object with the elements
Refined declaration: by |
contains | Source Code Determines if this range includes the given object. Refined declaration: contains |
containsElement | Source Code Determines if the range includes the given value. |
count | Source Code Return the number of elements in this Refined declaration: count |
equals | Source Code Determines if two ranges are the same by comparing their endpoints. Refined declaration: equals |
get | Source Code The element of the range that occurs Refined declaration: get |
includes | Source Code Determine if the given list occurs at some index in this list. Refined declaration: includes |
includesRange | Source Code Determines if this range includes the given range. |
iterator | Source Code An iterator for the elements of the range. Refined declaration: iterator |
occurs | Source Code Determines if this range includes the given value. Refined declaration: occurs |
segment | Source Code Obtain a segment containing the mapped values starting from the given index, with the given length. Refined declaration: segment |
skipping | Source Code Produce an Refined declaration: skipping |
span | Source Code Obtain a span containing the mapped values between the two given indices. Refined declaration: span |
spanFrom | Source Code Obtain a span containing the mapped values between the starting index and the end of the receiver. Refined declaration: spanFrom |
spanTo | Source Code Obtain a span containing the mapped values between the start of the receiver and the end index. Refined declaration: spanTo |
taking | Source Code Produce an Refined declaration: taking |
Inherited Methods |
Methods inherited from: Category |
Methods inherited from: Correspondence<Key,Item> |
Methods inherited from: Iterable<Element,Absent> any, by, chain, collect, count, cycle, defaultNullElements, every, filter, find, findLast, fold, following, iterator, longerThan, map, repeat, select, shorterThan, skipping, skippingWhile, sort, taking, takingWhile |
Methods inherited from: List<Element> |
Methods inherited from: Ranged<Index,Span> |