Package deltix.qsrv.hf.blocks.ixmap
Class IXMap<T>
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<IXKey,T>
-
- deltix.qsrv.hf.blocks.ixmap.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
-
-
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
-
-
-
-
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.
-
-