Class RefMap

  • All Implemented Interfaces:

    public class RefMap
    extends AbstractMap<String,​Ref>
    Specialized Map to present a RefDatabase namespace.

    Although not declared as a SortedMap, iterators from this map's projections always return references in RefComparator ordering. The map's internal representation is a sorted array of Ref objects, which means lookup and replacement is O(log N), while insertion and removal can be as expensive as O(N + log N) while the list expands or contracts. Since this is not a general map implementation, all entries must be keyed by the reference name.

    This class is really intended as a helper for RefDatabase, which needs to perform a merge-join of three sorted RefLists in order to present the unified namespace of the packed-refs file, the loose refs/ directory tree, and the resolved form of any symbolic references.