Class ImmutableLookupMap

java.lang.Object
com.google.common.collect.ForwardingObject
com.google.common.collect.ForwardingMap<String,String>
org.apache.druid.query.lookup.ImmutableLookupMap
All Implemented Interfaces:
Map<String,String>

public final class ImmutableLookupMap extends com.google.common.collect.ForwardingMap<String,String>
Similar to MapLookupExtractor, but immutable, and also reversible without iterating the entire map. Forward lookup, ImmutableLookupMap.ImmutableLookupExtractor.apply(String), is implemented using an Object2IntOpenHashMap with load factor LOAD_FACTOR. The value of the map is an index into keys and ForwardingMap.values(). Reverse lookup, ImmutableLookupMap.ImmutableLookupExtractor.unapply(String), is implemented using binary search through ForwardingMap.values(). The keys and ForwardingMap.values() lists are both sorted by value using VALUE_COMPARATOR. Relative to MapLookupExtractor backed by Java HashMap, this map has been observed to have somewhat lower footprint, same performance for ImmutableLookupMap.ImmutableLookupExtractor.apply(String), and significantly faster for ImmutableLookupMap.ImmutableLookupExtractor.unapply(String). It should be used whenever the map does not need to be mutated.