RangeValueIterator
public
interface
RangeValueIterator
android.icu.util.RangeValueIterator
|
Interface for enabling iteration over sets of <int index, int value>,
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
<int index, int value> with the same value. Result is represented by
<start, limit, value> 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);
}
Summary
Nested classes |
class |
RangeValueIterator.Element
Return result wrapper for android.icu.util.RangeValueIterator.
|
Public methods |
abstract
boolean
|
next(RangeValueIterator.Element element)
Returns the next maximal result range with a common value and returns
true if we are not at the end of the iteration, false otherwise.
|
abstract
void
|
reset()
Resets the iterator to the beginning of the iteration.
|
Public methods
next
public abstract boolean next (RangeValueIterator.Element element)
Returns the next maximal result range with a common value and returns
true if we are not at the end of the iteration, false otherwise.
If this returns a false, the contents of elements will not
be updated.
Parameters |
element |
RangeValueIterator.Element : for storing the result range and value |
Returns |
boolean |
true if we are not at the end of the iteration, false otherwise. |
reset
public abstract void reset ()
Resets the iterator to the beginning of the iteration.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# RangeValueIterator\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nRangeValueIterator\n==================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/icu/util/RangeValueIterator \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nRangeValueIterator\n`\n\n\n`\n\n\n`\n\n|-------------------------------------|\n| android.icu.util.RangeValueIterator |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\n\u003cbr /\u003e\n\nInterface for enabling iteration over sets of \\\u003cint index, int value\\\u003e,\nwhere index is the sorted integer index in ascending order and value, its\nassociated integer value.\n\nThe result for each iteration is the consecutive range of\n\\\u003cint index, int value\\\u003e with the same value. Result is represented by\n\\\u003cstart, limit, value\\\u003e where\n\n- start is the starting integer of the result range\n- 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.\n- value is the integer value that all integers from start to (limit - 1) share in common.\n\n\nHence value(start) = value(start + 1) = .... = value(start + n) = .... =\nvalue(limit - 1). However value(start -1) != value(start) and\nvalue(limit) != value(start).\n\nMost implementations will be created by factory methods, such as the\ncharacter type iterator in UCharacter.getTypeIterator. See example below.\n\nExample of use: \n\n```\n RangeValueIterator iterator = UCharacter.getTypeIterator();\n RangeValueIterator.Element result = new RangeValueIterator.Element();\n while (iterator.next(result)) {\n System.out.println(\"Codepoint \\\\u\" +\n Integer.toHexString(result.start) +\n \" to codepoint \\\\u\" +\n Integer.toHexString(result.limit - 1) +\n \" has the character type \" + result.value);\n }\n \n```\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Nested classes ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` class` | [RangeValueIterator.Element](/reference/android/icu/util/RangeValueIterator.Element) Return result wrapper for android.icu.util.RangeValueIterator. |\n\n| ### Public methods ||\n|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract boolean` | ` `[next](/reference/android/icu/util/RangeValueIterator#next(android.icu.util.RangeValueIterator.Element))`(`[RangeValueIterator.Element](/reference/android/icu/util/RangeValueIterator.Element)` element) ` \u003cbr /\u003e Returns the next maximal result range with a common value and returns true if we are not at the end of the iteration, false otherwise. |\n| ` abstract void` | ` `[reset](/reference/android/icu/util/RangeValueIterator#reset())`() ` Resets the iterator to the beginning of the iteration. |\n\nPublic methods\n--------------\n\n### next\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean next (RangeValueIterator.Element element)\n```\n\n\u003cbr /\u003e\n\nReturns the next maximal result range with a common value and returns\ntrue if we are not at the end of the iteration, false otherwise.\n\nIf this returns a false, the contents of elements will not\nbe updated.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----------|-----------------------------------------------------------------------------|\n| `element` | `RangeValueIterator.Element`: for storing the result range and value \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-------------------------------------------------------------------------|\n| `boolean` | true if we are not at the end of the iteration, false otherwise. \u003cbr /\u003e |\n\n**See also:**\n\n- [RangeValueIterator.Element](/reference/android/icu/util/RangeValueIterator.Element) \n\n### reset\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void reset ()\n```\n\nResets the iterator to the beginning of the iteration.\n\n\u003cbr /\u003e"]]