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<K,V>, 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 Details

    • ManyToManyIndex

      public ManyToManyIndex()
  • Method Details

    • index

      public void index(@NotNull K key, @NotNull V value)
    • 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.
    • removeByKey

      @Nullable public @Nullable Set<V> removeByKey(@NotNull K key)
    • removeByValue

      @Nullable public @Nullable Set<K> removeByValue(@NotNull V value)
    • getByKey

      @NotNull public @NotNull Set<V> getByKey(@NotNull K key)
    • getByValue

      @NotNull public @NotNull Set<K> getByValue(@NotNull V value)
    • clear

      public void clear()