Class ConcurrentLongPairSet

  • All Implemented Interfaces:
    LongPairSet

    public class ConcurrentLongPairSet
    extends java.lang.Object
    implements LongPairSet
    Concurrent hash set where values are composed of pairs of longs.

    Provides similar methods as a ConcurrentHashSet<V> but since it's an open hash set with linear probing, no node allocations are required to store the keys and values, and no boxing is required.

    Values MUST be >= 0.

    • Constructor Detail

      • ConcurrentLongPairSet

        @Deprecated
        public ConcurrentLongPairSet()
        Deprecated.
      • ConcurrentLongPairSet

        @Deprecated
        public ConcurrentLongPairSet​(int expectedItems)
        Deprecated.
      • ConcurrentLongPairSet

        @Deprecated
        public ConcurrentLongPairSet​(int expectedItems,
                                     int concurrencyLevel)
        Deprecated.
      • ConcurrentLongPairSet

        public ConcurrentLongPairSet​(int expectedItems,
                                     int concurrencyLevel,
                                     float mapFillFactor,
                                     float mapIdleFactor,
                                     boolean autoShrink,
                                     float expandFactor,
                                     float shrinkFactor)
    • Method Detail

      • size

        public long size()
        Description copied from interface: LongPairSet
        Returns size of the set.
        Specified by:
        size in interface LongPairSet
        Returns:
      • capacity

        public long capacity()
        Description copied from interface: LongPairSet
        Returns capacity of the set.
        Specified by:
        capacity in interface LongPairSet
        Returns:
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: LongPairSet
        Check if set is empty.
        Specified by:
        isEmpty in interface LongPairSet
        Returns:
      • contains

        public boolean contains​(long item1,
                                long item2)
        Description copied from interface: LongPairSet
        Checks if given (item1,item2) composite value exists into set.
        Specified by:
        contains in interface LongPairSet
        Returns:
      • add

        public boolean add​(long item1,
                           long item2)
        Description copied from interface: LongPairSet
        Adds composite value of item1 and item2 to set.
        Specified by:
        add in interface LongPairSet
        Returns:
      • remove

        public boolean remove​(long item1,
                              long item2)
        Remove an existing entry if found.
        Specified by:
        remove in interface LongPairSet
        Parameters:
        item1 -
        Returns:
        true if removed or false if item was not present
      • clear

        public void clear()
        Description copied from interface: LongPairSet
        Removes all items from set.
        Specified by:
        clear in interface LongPairSet
      • removeIf

        public int removeIf​(LongPairSet.LongPairPredicate filter)
        Removes all of the elements of this collection that satisfy the given predicate.
        Specified by:
        removeIf in interface LongPairSet
        Parameters:
        filter - a predicate which returns true for elements to be removed
        Returns:
        number of removed values
      • items

        public <T> java.util.Set<T> items​(int numberOfItems,
                                          LongPairSet.LongPairFunction<T> longPairConverter)
        Specified by:
        items in interface LongPairSet
        longPairConverter - converts (long,long) pair to object
        Returns:
        a new list of keys with max provided numberOfItems
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object