Class ManyToManyIndex<K,V>
- java.lang.Object
-
- com.atlassian.bamboo.plan.cache.index.util.ManyToManyIndex<K,V>
-
@Internal @ThreadSafe public class ManyToManyIndex<K,V> extends Object
A class that allows to index any key <-> value, many-to-many relationship. The key characteristics of this class is that, unlike Multimap, 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 ManyToManyIndex()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
@NotNull Map<V,Set<K>>
getBackwardMapping()
You need to synchronize on this object if using this method.@NotNull Set<V>
getByKey(K key)
@NotNull Set<K>
getByValue(V value)
@NotNull Map<K,Set<V>>
getForwardMapping()
You need to synchronize on this object if using this method.void
index(K key, V value)
@Nullable Set<V>
removeByKey(K key)
@Nullable Set<K>
removeByValue(V value)
-
-
-
Method Detail
-
getForwardMapping
@NotNull public @NotNull Map<K,Set<V>> getForwardMapping()
You need to synchronize on this object if using this method.
-
getBackwardMapping
@NotNull public @NotNull Map<V,Set<K>> getBackwardMapping()
You need to synchronize on this object if using this method.
-
clear
public void clear()
-
-