Interface DistributedHashSet<T>

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addRange​(java.util.Collection<T> collection)
      Insert elements of the provided collection in DistributedHashSet.
      void copyTo​(T[] array, int arrayIndex)
      Copies the HashSet elements to the specified array, starting at the specified index.
      java.util.Collection<T> difference​(java.lang.String other)
      Returns the difference of current set with the specified set.
      T getRandom()
      Return a random element from the set.
      T[] getRandom​(int count)
      Returns count distinct random elements from the set.
      java.util.Collection<T> intersect​(java.lang.String other)
      Returns the intersection of current set with the specified set.
      int remove​(java.util.Collection<T> items)
      Remove the specified items from the set.
      T removeRandom()
      Removes and returns a random element from the set.
      DistributedHashSet<T> storeDifference​(java.lang.String destination, java.lang.String other)
      Take difference of current set with the specified set and store the result in a new destination set.
      DistributedHashSet<T> storeIntersection​(java.lang.String destination, java.lang.String other)
      Take intersection of current set with the specified set and store the result in a new destination set.
      DistributedHashSet<T> storeUnion​(java.lang.String destination, java.lang.String other)
      Take union of current set with the specified set and store the result in a new destination set.
      java.util.Collection<T> union​(java.lang.String other)
      Returns the union of current set with the specified set.
      • Methods inherited from interface java.util.Collection

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface com.alachisoft.ncache.client.datastructures.Lockable

        lock, unlock
      • Methods inherited from interface java.util.Set

        add, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
    • Method Detail

      • addRange

        void addRange​(java.util.Collection<T> collection)
        Insert elements of the provided collection in DistributedHashSet.
        Parameters:
        collection - Elements to be inserted in the DistributedHashSet.
      • copyTo

        void copyTo​(T[] array,
                    int arrayIndex)
        Copies the HashSet elements to the specified array, starting at the specified index.
        Parameters:
        array - The destination array of the elements copied from Hashset.
        arrayIndex - he zero-based index in array at which copying begins.
      • removeRandom

        T removeRandom()
        Removes and returns a random element from the set.
        Returns:
        Random element from set.
      • getRandom

        T getRandom()
        Return a random element from the set.
        Returns:
        Random element from set.
      • getRandom

        T[] getRandom​(int count)
        Returns count distinct random elements from the set.
        Parameters:
        count - Number of required elements.
        Returns:
        Count distinct elements from set.
      • remove

        int remove​(java.util.Collection<T> items)
        Remove the specified items from the set.
        Parameters:
        items - Items to remove from the set.
        Returns:
        The number of members that were removed from the set.
      • union

        java.util.Collection<T> union​(java.lang.String other)
                               throws CacheException
        Returns the union of current set with the specified set.
        Parameters:
        other - Name of set to compare with.
        Returns:
        Union of current set with the specified set.
        Throws:
        CacheException
      • intersect

        java.util.Collection<T> intersect​(java.lang.String other)
                                   throws CacheException
        Returns the intersection of current set with the specified set.
        Parameters:
        other - Name of set to compare with.
        Returns:
        Intersection of current set with the specified set.
        Throws:
        CacheException
      • difference

        java.util.Collection<T> difference​(java.lang.String other)
                                    throws CacheException
        Returns the difference of current set with the specified set.
        Parameters:
        other - Name of set to compare with.
        Returns:
        Difference of current set with the specified set.
        Throws:
        CacheException
      • storeUnion

        DistributedHashSet<T> storeUnion​(java.lang.String destination,
                                         java.lang.String other)
                                  throws CacheException
        Take union of current set with the specified set and store the result in a new destination set.
        Parameters:
        destination - Name of destination set.
        other - Name of set to compare with.
        Returns:
        Interface of destination set handler.
        Throws:
        CacheException
      • storeDifference

        DistributedHashSet<T> storeDifference​(java.lang.String destination,
                                              java.lang.String other)
                                       throws CacheException
        Take difference of current set with the specified set and store the result in a new destination set.
        Parameters:
        destination - Name of destination set.
        other - Name of set to compare with.
        Returns:
        Interface of destination set handler.
        Throws:
        CacheException
      • storeIntersection

        DistributedHashSet<T> storeIntersection​(java.lang.String destination,
                                                java.lang.String other)
                                         throws CacheException
        Take intersection of current set with the specified set and store the result in a new destination set.
        Parameters:
        destination - Name of destination set.
        other - Name of set to compare with.
        Returns:
        Interface of destination set handler.
        Throws:
        CacheException