Class IXMap<T>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.util.Map<IXKey,​T>

    public class IXMap<T>
    extends java.util.HashMap<IXKey,​T>
    Efficiently maps the pair of (instrument identity, exchange code) to arbitrary objects. Typical usage pattern:
    public synchronized XYZ     getOrCreateXYZ (
        CharSequence                exchangeCode, 
        CharSequence                symbol,
        InstrumentType              type
    )
    {
        // the following variant of get() does not allocate memory:
        XYZ       ret = map.get (exchangeCode, symbol, type);
            
        if (ret == null) {
            // IF we are adding a new entry, THEN we have to allocate memory:
            ImmutableIXKey    key = new ImmutableIXKey (exchangeCode, symbol, type);
            ret = new XYZ (..., key);            
            map.put (key, ret);
        }
    
        return (ret);
    }
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.util.AbstractMap

        java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,​V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,​V extends java.lang.Object>
      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Constructor Summary

      Constructors 
      Constructor Description
      IXMap()  
      IXMap​(int initialCapacity)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T get​(java.lang.CharSequence exchangeCode, java.lang.CharSequence symbol, deltix.qsrv.hf.pub.InstrumentType type)
      Quickly looks up an object without allocating memory for an immutable key.
      • Methods inherited from class java.util.HashMap

        clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
      • Methods inherited from class java.util.AbstractMap

        equals, hashCode, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Map

        equals, hashCode
    • Constructor Detail

      • IXMap

        public IXMap()
      • IXMap

        public IXMap​(int initialCapacity)
    • Method Detail

      • get

        public T get​(java.lang.CharSequence exchangeCode,
                     java.lang.CharSequence symbol,
                     deltix.qsrv.hf.pub.InstrumentType type)
        Quickly looks up an object without allocating memory for an immutable key.
        Returns:
        The same result as get (new ImmutableIXKey (exchangeCode, symbol, type)), but without allocating memory.