Class SortedObjectIndex<E extends Comparable<? super E>>

  • All Implemented Interfaces:
    Iterable<E>, Collection<E>
    Direct Known Subclasses:
    ModuleIndex, PluginIndex, ServiceIndex

    public class SortedObjectIndex<E extends Comparable<? super E>>
    extends ObjectIndex<E>
    Data structure for managing sorted lists of registered objects.

    This data structure is the same as a vanilla ObjectIndex except that each type list is kept in sorted order; hence, the items managed must implement the Comparable interface. When adding a single item (i.e., with ObjectIndex.add(Object)), a binary search is used to insert it in the correct position (O(log n) + O(n) time per item). When adding multiple items at once (i.e., with addAll(Collection)), the items are appended and the list is then resorted (O(n log n) time for all items).

    Author:
    Curtis Rueden