Class UnsafeManyToManyIndex<K,V>

java.lang.Object
com.atlassian.bamboo.plan.cache.index.util.unsafe.UnsafeManyToManyIndex<K,V>

@Internal @NotThreadSafe public class UnsafeManyToManyIndex<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 _not thread safe_.
  • Constructor Details

    • UnsafeManyToManyIndex

      public UnsafeManyToManyIndex()
  • 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)
    • getByKeyUnsafe

      @NotNull public @NotNull Set<V> getByKeyUnsafe(@NotNull K key)
      Does not perform a copy, can only be used in context that are thread safe from perspective of this object
    • getByValue

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

      @NotNull public @NotNull Set<K> getByValueUnsafe(@NotNull V value)
      Does not perform a copy, can only be used in context that are thread safe from perspective of this object
    • clear

      public void clear()