Interface for enabling iteration over sets of ,
where index is the sorted integer index in ascending order and value, its
associated integer value.
The result for each iteration is the consecutive range of
with the same value. Result is represented by
where
- start is the starting integer of the result range
- limit is 1 after the maximum integer that follows start, such that
all integers between start and (limit - 1), inclusive, have the same
associated integer value.
- value is the integer value that all integers from start to (limit - 1)
share in common.
Hence value(start) = value(start + 1) = .... = value(start + n) = .... =
value(limit - 1). However value(start -1) != value(start) and
value(limit) != value(start).
Most implementations will be created by factory methods, such as the
character type iterator in UCharacter.getTypeIterator. See example below.
Example of use:
RangeValueIterator iterator = UCharacter.getTypeIterator();
RangeValueIterator.Element result = new RangeValueIterator.Element();
while (iterator.next(result)) {
System.out.println("Codepoint \\u" +
Integer.toHexString(result.start) +
" to codepoint \\u" +
Integer.toHexString(result.limit - 1) +
" has the character type " + result.value);
}
author: synwee |