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:
    java.lang.Iterable<AlphabeticIndex.Bucket<V>>
    Enclosing class:
    AlphabeticIndex<V>

    public static final class AlphabeticIndex.ImmutableIndex<V>
    extends java.lang.Object
    implements java.lang.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 Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      AlphabeticIndex.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​(java.lang.CharSequence name)
      Finds the index bucket for the given name and returns the number of that bucket.
      java.util.Iterator<AlphabeticIndex.Bucket<V>> iterator()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • 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​(java.lang.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
      • iterator

        public java.util.Iterator<AlphabeticIndex.Bucket<V>> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<V>