Skip to content

Most visited

Recently visited

navigation
Added in API level 24

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

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

Added in API level 24
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.

See also:

reset

Added in API level 24
void reset ()

Resets the iterator to the beginning of the iteration.

This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.