Class AlphabeticIndex.ImmutableIndex<V>

  • Type Parameters:
    V - The Record value type is unused. It can be omitted for this class if it was omitted for the AlphabeticIndex that built it.
    All Implemented Interfaces:
    Iterable<AlphabeticIndex.Bucket<V>>
    Enclosing class:
    AlphabeticIndex<V>

    public static final class AlphabeticIndex.ImmutableIndex<V>
    extends Object
    implements Iterable<AlphabeticIndex.Bucket<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.
    • Method Detail

      • getBucketCount

        public int getBucketCount()
        Returns the number of index buckets and labels, including underflow/inflow/overflow.
        Returns:
        the number of index buckets
      • getBucketIndex

        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 - the string to be sorted into an index bucket
        Returns:
        the bucket number for the name
      • getBucket

        public AlphabeticIndex.Bucket<V> getBucket​(int index)
        Returns the index-th bucket. Returns null if the index is out of range.
        Parameters:
        index - bucket number
        Returns:
        the index-th bucket