Class OneToOneIndex<K,V>
- java.lang.Object
-
- com.atlassian.bamboo.plan.cache.index.util.OneToOneIndex<K,V>
-
@Internal @ThreadSafe public class OneToOneIndex<K,V> extends Object
A class that allows to index any key <-> value, one-to-one relationship. The key characteristics of this class is that, unlike Map, it doesn't require linear scan when removing by value. Both K and V must have hashCode() and equals() correctly defined. The class is, for the most part, thread safe. Important: if accessing forward and backward mapping directly, calling code should synchronize on this object.
-
-
Constructor Summary
Constructors Constructor Description OneToOneIndex()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
@NotNull Map<V,K>
getBackwardMapping()
You need to synchronize on this object if using this method.V
getByKey(K key)
K
getByValue(V value)
@NotNull Map<K,V>
getForwardMapping()
You need to synchronize on this object if using this method.void
index(K key, V value)
V
removeByKey(K key)
K
removeByValue(V value)
-
-
-
Method Detail
-
getForwardMapping
@NotNull public @NotNull Map<K,V> getForwardMapping()
You need to synchronize on this object if using this method.
-
getBackwardMapping
@NotNull public @NotNull Map<V,K> getBackwardMapping()
You need to synchronize on this object if using this method.
-
clear
public void clear()
-
-