org.jjoost.collections.sets.wrappers
Class SynchronizedSet<V>

java.lang.Object
  extended by org.jjoost.collections.base.SynchronizedDelegator
      extended by org.jjoost.collections.sets.wrappers.SynchronizedArbitrarySet<V,Set<V>>
          extended by org.jjoost.collections.sets.wrappers.SynchronizedSet<V>
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<V>, AnyReadSet<V>, AnySet<V>, Set<V>, Function<V,java.lang.Boolean>

public class SynchronizedSet<V>
extends SynchronizedArbitrarySet<V,Set<V>>
implements Set<V>

See Also:
Serialized Form

Constructor Summary
SynchronizedSet(Set<V> delegate)
           
 
Method Summary
 Set<V> copy()
          Returns a copy of the set.
 V get(V key)
          Returns the value stored in the set that is equal to the provided value, as determined by any provided Equality or Comparator.
 int size()
          A convenience method returning the size of the set; this is equivalent to totalCount() or uniqueCount()
 Set<V> unique()
          Returns an AnySet (usually a Set) representing only the unique values present in this set; if this set is already unique this method should return the set itself.
 
Methods inherited from class org.jjoost.collections.sets.wrappers.SynchronizedArbitrarySet
add, all, apply, clear, clearAndReturn, contains, count, equality, first, isEmpty, iterator, list, permitsDuplicates, put, putAll, putIfAbsent, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, removeAndReturnFirst, shrink, totalCount, uniqueCount
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jjoost.collections.Set
put
 
Methods inherited from interface org.jjoost.collections.AnySet
add, clear, clearAndReturn, putAll, putIfAbsent, remove, remove, removeAndReturn, removeAndReturn, removeAndReturnFirst, removeAndReturnFirst, shrink
 
Methods inherited from interface org.jjoost.collections.AnyReadSet
all, contains, count, equality, first, isEmpty, list, permitsDuplicates, totalCount, uniqueCount
 
Methods inherited from interface java.lang.Iterable
iterator
 
Methods inherited from interface org.jjoost.util.Function
apply
 

Constructor Detail

SynchronizedSet

public SynchronizedSet(Set<V> delegate)
Method Detail

unique

public Set<V> unique()
Description copied from interface: AnySet
Returns an AnySet (usually a Set) representing only the unique values present in this set; if this set is already unique this method should return the set itself. Changes to each set should be reflected in the other, however put() operations on the unique() set will not be supported if the underlying set is not itself unique.

Specified by:
unique in interface AnyReadSet<V>
Specified by:
unique in interface AnySet<V>
Specified by:
unique in interface Set<V>
Overrides:
unique in class SynchronizedArbitrarySet<V,Set<V>>
Returns:
unique values

copy

public Set<V> copy()
Description copied from interface: AnySet
Returns a copy of the set. This method may or may not return a set of the same class as the one it was called on, however must be of the same basic interface (either Set or MultiSet).

Specified by:
copy in interface AnySet<V>
Specified by:
copy in interface Set<V>
Overrides:
copy in class SynchronizedArbitrarySet<V,Set<V>>

get

public V get(V key)
Description copied from interface: Set
Returns the value stored in the set that is equal to the provided value, as determined by any provided Equality or Comparator. Returns null if no matching item is stored in the set. Equivalent to first(key)

Specified by:
get in interface Set<V>
Parameters:
key - value to find
Returns:
first matching value

size

public int size()
Description copied from interface: Set
A convenience method returning the size of the set; this is equivalent to totalCount() or uniqueCount()

Specified by:
size in interface Set<V>
Returns:
size of the set