Interface DistributedHashSet<T>
-
- Type Parameters:
T
- The type of the elements in the HashSet.
- All Superinterfaces:
java.util.Collection<T>
,DistributedDataStructure
,java.lang.Iterable<T>
,Lockable
,Notifiable
,java.util.Set<T>
public interface DistributedHashSet<T> extends java.util.Set<T>, DistributedDataStructure, Notifiable
This interface contains methods and parameters for Distributed HashSet.
-
-
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 the current Set with the specified Set.-
Methods inherited from interface com.alachisoft.ncache.client.datastructures.DistributedDataStructure
getKey, getWriteThruOptions, setWriteThruOptions
-
Methods inherited from interface com.alachisoft.ncache.client.datastructures.Notifiable
addChangeListener, removeChangeListener
-
-
-
-
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
- The 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 the Set.
-
getRandom
T getRandom()
Return a random element from the Set.- Returns:
- Random element from the 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 the 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 the 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 SeSt 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 the 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 a destination Set.other
- Name of the Set to compare with.- Returns:
- Interface of destination Set handler.
- Throws:
CacheException
-
-