Stay organized with collections
Save and categorize content based on your preferences.
RangeValueIterator
interface 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 |
open |
Return result wrapper for android.
|
Public methods |
abstract Boolean |
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 Unit |
Resets the iterator to the beginning of the iteration.
|
Public methods
next
abstract fun next(element: RangeValueIterator.Element!): Boolean
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.
Return |
Boolean |
true if we are not at the end of the iteration, false otherwise. |
reset
abstract fun reset(): Unit
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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nRangeValueIterator\n==================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/icu/util/RangeValueIterator \"View this page in Java\") \n\n```\ninterface RangeValueIterator\n```\n\n|------------------------------------------|\n| [android.icu.util.RangeValueIterator](#) |\n\nInterface for enabling iteration over sets of \\\u003cint index, int value\\\u003e, where index is the sorted integer index in ascending order and value, its associated integer value.\n\nThe result for each iteration is the consecutive range of \\\u003cint index, int value\\\u003e with the same value. Result is represented by \\\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\nHence value(start) = value(start + 1) = .... = value(start + n) = .... = value(limit - 1). However value(start -1) != value(start) and value(limit) != value(start).\n\nMost implementations will be created by factory methods, such as the character type iterator in UCharacter.getTypeIterator. See example below.\n\nExample of use: \n\n```kotlin\nRangeValueIterator 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\nSummary\n-------\n\n| Nested classes ||\n|------|-------------------------------------------------------------------------------------------------------------|\n| open | [Element](/reference/kotlin/android/icu/util/RangeValueIterator.Element) Return result wrapper for android. |\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [next](#next(android.icu.util.RangeValueIterator.Element))`(`element:` `[RangeValueIterator.Element](/reference/kotlin/android/icu/util/RangeValueIterator.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. |\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [reset](#reset())`()` Resets the iterator to the beginning of the iteration. |\n\nPublic methods\n--------------\n\n### next\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun next(element: RangeValueIterator.Element!): Boolean\n```\n\nReturns 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\nIf this returns a false, the contents of elements will not be updated.\n\n| Parameters ||\n|-----------|--------------------------------------------------------------------------------------------------------------------------------------|\n| `element` | [RangeValueIterator.Element](/reference/kotlin/android/icu/util/RangeValueIterator.Element)!: for storing the result range and value |\n\n| Return ||\n|------------------------------------------------------------------------------------|------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | true if we are not at the end of the iteration, false otherwise. |\n\n**See Also**\n\n- [android.icu.util.RangeValueIterator.Element](/reference/kotlin/android/icu/util/RangeValueIterator.Element) \n\n### reset\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun reset(): Unit\n```\n\nResets the iterator to the beginning of the iteration."]]