Class BidirectionalObjectToIdMapIdentity<V>
java.lang.Object
ch.qos.logback.core.kryo.BidirectionalObjectToIdMapIdentity<V>
- All Implemented Interfaces:
BidirectionalObjectToIdMap<V>
public class BidirectionalObjectToIdMapIdentity<V>
extends Object
implements BidirectionalObjectToIdMap<V>
Value↔id map keyed by object identity (
== / System.identityHashCode(Object)),
with access-order LRU eviction at capacity.
Equal-but-distinct instances are different keys. getIdByValue(V) and
getValueById(int) count as uses. Evicted ids are reused for later inserts.
idToValue is a plain HashMap; LRU order lives only in valueToId.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetIdByValue(V value) Returns the id for the given value or null if the value is not mapped.getValueById(int id) Returns the value mapped to the given id or null if there is no such mapping.insertNewEntryOnRead(int id, V value) Inserts a new entry mapping the given id to the given value.insertNewEntryOnWrite(V value) Inserts a new entry mapping an id to the given value.
-
Constructor Details
-
BidirectionalObjectToIdMapIdentity
-
-
Method Details
-
getIdByValue
Description copied from interface:BidirectionalObjectToIdMapReturns the id for the given value or null if the value is not mapped.- Specified by:
getIdByValuein interfaceBidirectionalObjectToIdMap<V>
-
insertNewEntryOnWrite
Description copied from interface:BidirectionalObjectToIdMapInserts a new entry mapping an id to the given value. Reuses an id freed by LRU eviction when the map is at capacity; otherwise assigns the next unused id. Returns the assigned id.- Specified by:
insertNewEntryOnWritein interfaceBidirectionalObjectToIdMap<V>
-
insertNewEntryOnRead
Description copied from interface:BidirectionalObjectToIdMapInserts a new entry mapping the given id to the given value.Any existing entry with the same value if removed from the valueToId map.
Returns the existing value mapped to the given id or null if there was no existing mapping.- Specified by:
insertNewEntryOnReadin interfaceBidirectionalObjectToIdMap<V>
-
getValueById
Description copied from interface:BidirectionalObjectToIdMapReturns the value mapped to the given id or null if there is no such mapping.- Specified by:
getValueByIdin interfaceBidirectionalObjectToIdMap<V>
-