Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in API level 24

AlphabeticIndex.ImmutableIndex

public static final class AlphabeticIndex.ImmutableIndex
extends Object implements Iterable<Bucket<V>>

java.lang.Object
   ↳ android.icu.text.AlphabeticIndex.ImmutableIndex<V>


Immutable, thread-safe version of AlphabeticIndex. This class provides thread-safe methods for bucketing, and random access to buckets and their properties, but does not offer adding records to the index.

Summary

Public methods

Bucket<V> getBucket(int index)

Returns the index-th bucket.

int getBucketCount()

Returns the number of index buckets and labels, including underflow/inflow/overflow.

int getBucketIndex(CharSequence name)

Finds the index bucket for the given name and returns the number of that bucket.

Iterator<Bucket<V>> iterator()

Returns an iterator over elements of type T.

Inherited methods

Public methods

getBucket

added in API level 24
public Bucket<V> getBucket (int index)

Returns the index-th bucket. Returns null if the index is out of range.

Parameters
index int: bucket number

Returns
Bucket<V> the index-th bucket

getBucketCount

added in API level 24
public int getBucketCount ()

Returns the number of index buckets and labels, including underflow/inflow/overflow.

Returns
int the number of index buckets

getBucketIndex

added in API level 24
public int getBucketIndex (CharSequence name)

Finds the index bucket for the given name and returns the number of that bucket. Use getBucket(int) to get the bucket's properties.

Parameters
name CharSequence: the string to be sorted into an index bucket

Returns
int the bucket number for the name

iterator

added in API level 24
public Iterator<Bucket<V>> iterator ()

Returns an iterator over elements of type T.

Returns
Iterator<Bucket<V>> an Iterator.