public class SynchronizedIndexedSet<K,V> extends IndexedSet<K,V>
IndexedSet class.
 It provides following benefits over standard IndexedSet:
 Note that SynchronizedIndexedSet can be wrapped by IndexedMap
 to create what can be considered a SynchronizedIndexedMap.
| Modifier | Constructor and Description | 
|---|---|
|   | SynchronizedIndexedSet()Creates new empty set with default indexer  IndexerFunction.DEFAULT. | 
|   | SynchronizedIndexedSet(Collection<V> c)Creates a new set containing the elements in the specified collection. | 
|   | SynchronizedIndexedSet(Indexer<K,? super V> indexer)Deprecated. 
 Use  create(indexer) | 
|   | SynchronizedIndexedSet(Indexer<K,? super V> indexer,
                      Collection<? extends V> c)Deprecated. 
 | 
|   | SynchronizedIndexedSet(Indexer<K,? super V> indexer,
                      int initialCapacity)Deprecated. 
 | 
| protected  | SynchronizedIndexedSet(IndexerFunction<K,? super V> indexer)Creates new empty set with specified indexer. | 
| protected  | SynchronizedIndexedSet(IndexerFunction<K,? super V> indexer,
                      Collection<? extends V> c)Creates a new set with specified indexer containing the elements in the specified collection. | 
| protected  | SynchronizedIndexedSet(IndexerFunction<K,? super V> indexer,
                      int initialCapacity)Creates new empty set with specified indexer and specified initial capacity. | 
|   | SynchronizedIndexedSet(int initialCapacity)Creates new empty set with default indexer  IndexerFunction.DEFAULTand specified initial capacity. | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | addAll(Collection<? extends V> c)Adds all of the elements in the specified collection into this set and
 returns true if this operation has increased the size of this set. | 
| void | clear()Removes all elements from this set. | 
| SynchronizedIndexedSet<K,V> | clone()Returns a shallow copy of this set - the values themselves are not cloned. | 
| static <V> Collector<V,?,? extends SynchronizedIndexedSet<V,V>> | collector()Returns a  Collectorthat accumulates the input elements into a newSynchronizedIndexedSetwith default indexer. | 
| static <V> Collector<V,?,? extends SynchronizedIndexedSet<Integer,V>> | collector(IndexerFunction.IntKey<? super V> indexer)Deprecated. 
 | 
| static <V> Collector<V,?,? extends SynchronizedIndexedSet<Long,V>> | collector(IndexerFunction.LongKey<? super V> indexer)Deprecated. 
 | 
| static <K,V> Collector<V,?,? extends SynchronizedIndexedSet<K,V>> | collector(IndexerFunction<K,? super V> indexer)Returns a  Collectorthat accumulates the input elements into a newSynchronizedIndexedSetwith specified indexer. | 
| static <V> Collector<V,?,? extends SynchronizedIndexedSet<V,V>> | collectorIdentity()Returns a  Collectorthat accumulates the input elements into a newSynchronizedIndexedSetwith default identity indexer. | 
| static <K,V> Collector<V,?,? extends SynchronizedIndexedSet<K,V>> | collectorIdentity(IndexerFunction.IdentityKey<K,? super V> indexer)Returns a  Collectorthat accumulates the input elements into a newSynchronizedIndexedSetwith specified identity indexer. | 
| static <V> Collector<V,?,? extends SynchronizedIndexedSet<Integer,V>> | collectorInt(IndexerFunction.IntKey<? super V> indexer)Returns a  Collectorthat accumulates the input elements into a newSynchronizedIndexedSetwith specified int indexer. | 
| static <V> Collector<V,?,? extends SynchronizedIndexedSet<Long,V>> | collectorLong(IndexerFunction.LongKey<? super V> indexer)Returns a  Collectorthat accumulates the input elements into a newSynchronizedIndexedSetwith specified long indexer. | 
| static <V> SynchronizedIndexedSet<V,V> | create()Creates new empty set with default indexer  IndexerFunction.DEFAULT. | 
| static <V> SynchronizedIndexedSet<Integer,V> | create(IndexerFunction.IntKey<? super V> indexer)Deprecated. 
 | 
| static <V> SynchronizedIndexedSet<Integer,V> | create(IndexerFunction.IntKey<? super V> indexer,
      Collection<? extends V> c)Deprecated. 
 | 
| static <V> SynchronizedIndexedSet<Integer,V> | create(IndexerFunction.IntKey<? super V> indexer,
      int initialCapacity)Deprecated. 
 | 
| static <V> SynchronizedIndexedSet<Long,V> | create(IndexerFunction.LongKey<? super V> indexer)Deprecated. 
 | 
| static <V> SynchronizedIndexedSet<Long,V> | create(IndexerFunction.LongKey<? super V> indexer,
      int initialCapacity)Deprecated. 
 | 
| static <K,V> SynchronizedIndexedSet<K,V> | create(IndexerFunction<K,? super V> indexer)Creates new empty set with specified indexer. | 
| static <K,V> SynchronizedIndexedSet<K,V> | create(IndexerFunction<K,? super V> indexer,
      Collection<? extends V> c)Deprecated. 
 | 
| static <K,V> SynchronizedIndexedSet<K,V> | create(IndexerFunction<K,? super V> indexer,
      int initialCapacity)Deprecated. 
 | 
| static <V> SynchronizedIndexedSet<V,V> | createIdentity()Creates new empty set with default identity indexer. | 
| static <K,V> SynchronizedIndexedSet<K,V> | createIdentity(IndexerFunction.IdentityKey<K,? super V> indexer)Creates new empty set with specified identity indexer. | 
| static <V> SynchronizedIndexedSet<Integer,V> | createInt(IndexerFunction.IntKey<? super V> indexer)Creates new empty set with specified int indexer. | 
| static <V> SynchronizedIndexedSet<Long,V> | createLong(IndexerFunction.LongKey<? super V> indexer)Creates new empty set with specified long indexer. | 
| void | ensureCapacity(int capacity)Increases the capacity of this set instance, if necessary, to ensure that it
 can hold at least the number of elements specified by the capacity argument. | 
| IndexedSetStats | getStats()Returns static structure statistics of this set. | 
| static <V> SynchronizedIndexedSet<V,V> | of(V... objs)Creates a new set with default indexer containing specified elements. | 
| V | put(V value)Puts specified element into this set and returns previous element that matches specified one. | 
| V | putIfAbsentAndGet(V value)Puts specified element into this set if it is absent and
 returns current element in the set that matches specified one. | 
| boolean | removeAll(Collection<?> c)Removes all of the elements in the specified collection from this set and
 returns true if this operation has decreased the size of this set. | 
| boolean | removeIf(Predicate<? super V> filter) | 
| V | removeKey(K key)Removes the element from this set which matches specified key if it is present
 and returns removed element or null if none were found. | 
| V | removeKey(long key)Removes the element from this set which matches specified key if it is present
 and returns removed element or null if none were found. | 
| V | removeValue(V value)Removes the element from this set which matches specified value if it is present
 and returns removed element or null if none were found. | 
| boolean | retainAll(Collection<?> c)Retains only the elements in this set that are contained in the specified collection. | 
| void | trimToSize()Trims the capacity of this set instance to be the set's current size. | 
| SynchronizedIndexedSet<K,V> | withCapacity(int capacity)Increases the capacity of this set instance, if necessary, to ensure that it
 can hold at least the number of elements specified by the capacity argument. | 
| SynchronizedIndexedSet<K,V> | withElements(Collection<? extends V> c)Adds all of the elements in the specified collection into this set. | 
add, concurrentIterator, contains, containsKey, containsKey, containsKey, containsValue, create, entryIterator, getByKey, getByKey, getByKey, getByValue, getIndexer, getIndexerFunction, iterator, keyIterator, remove, removeKey, size, toArray, toArraycontainsAll, equals, hashCode, isEmpty, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitspliteratorparallelStream, streampublic SynchronizedIndexedSet()
IndexerFunction.DEFAULT.public SynchronizedIndexedSet(int initialCapacity)
IndexerFunction.DEFAULT and specified initial capacity.protected SynchronizedIndexedSet(IndexerFunction<K,? super V> indexer)
@Deprecated public SynchronizedIndexedSet(Indexer<K,? super V> indexer)
create(indexer)protected SynchronizedIndexedSet(IndexerFunction<K,? super V> indexer, int initialCapacity)
@Deprecated public SynchronizedIndexedSet(Indexer<K,? super V> indexer, int initialCapacity)
create(indexer).withCapacity(initialCapacity)public SynchronizedIndexedSet(Collection<V> c)
IndexedSet, then new indexed set uses same indexer,
 otherwise it uses default indexer IndexerFunction.DEFAULT.protected SynchronizedIndexedSet(IndexerFunction<K,? super V> indexer, Collection<? extends V> c)
@Deprecated public SynchronizedIndexedSet(Indexer<K,? super V> indexer, Collection<? extends V> c)
create(indexer).withElements(c)public static <V> SynchronizedIndexedSet<V,V> create()
IndexerFunction.DEFAULT.public static <V> SynchronizedIndexedSet<V,V> createIdentity()
public static <K,V> SynchronizedIndexedSet<K,V> create(IndexerFunction<K,? super V> indexer)
public static <K,V> SynchronizedIndexedSet<K,V> createIdentity(IndexerFunction.IdentityKey<K,? super V> indexer)
public static <V> SynchronizedIndexedSet<Integer,V> createInt(IndexerFunction.IntKey<? super V> indexer)
public static <V> SynchronizedIndexedSet<Long,V> createLong(IndexerFunction.LongKey<? super V> indexer)
@Deprecated public static <V> SynchronizedIndexedSet<Integer,V> create(IndexerFunction.IntKey<? super V> indexer)
createInt(indexer)@Deprecated public static <V> SynchronizedIndexedSet<Long,V> create(IndexerFunction.LongKey<? super V> indexer)
createLong(indexer)@Deprecated public static <K,V> SynchronizedIndexedSet<K,V> create(IndexerFunction<K,? super V> indexer, int initialCapacity)
create(indexer).withCapacity(initialCapacity)@Deprecated public static <V> SynchronizedIndexedSet<Integer,V> create(IndexerFunction.IntKey<? super V> indexer, int initialCapacity)
createInt(indexer).withCapacity(initialCapacity)@Deprecated public static <V> SynchronizedIndexedSet<Long,V> create(IndexerFunction.LongKey<? super V> indexer, int initialCapacity)
createLong(indexer).withCapacity(initialCapacity)@Deprecated public static <K,V> SynchronizedIndexedSet<K,V> create(IndexerFunction<K,? super V> indexer, Collection<? extends V> c)
create(indexer).withElements(c)@Deprecated public static <V> SynchronizedIndexedSet<Integer,V> create(IndexerFunction.IntKey<? super V> indexer, Collection<? extends V> c)
createInt(indexer).withElements(c)@SafeVarargs public static <V> SynchronizedIndexedSet<V,V> of(V... objs)
public static <V> Collector<V,?,? extends SynchronizedIndexedSet<V,V>> collector()
Collector that accumulates the input elements into a new SynchronizedIndexedSet with default indexer.
 This is an concurrent and unordered Collector.public static <V> Collector<V,?,? extends SynchronizedIndexedSet<V,V>> collectorIdentity()
Collector that accumulates the input elements into a new SynchronizedIndexedSet with default identity indexer.
 This is an concurrent and unordered Collector.public static <K,V> Collector<V,?,? extends SynchronizedIndexedSet<K,V>> collector(IndexerFunction<K,? super V> indexer)
Collector that accumulates the input elements into a new SynchronizedIndexedSet with specified indexer.
 This is an concurrent and unordered Collector.public static <K,V> Collector<V,?,? extends SynchronizedIndexedSet<K,V>> collectorIdentity(IndexerFunction.IdentityKey<K,? super V> indexer)
Collector that accumulates the input elements into a new SynchronizedIndexedSet with specified identity indexer.
 This is an concurrent and unordered Collector.public static <V> Collector<V,?,? extends SynchronizedIndexedSet<Integer,V>> collectorInt(IndexerFunction.IntKey<? super V> indexer)
Collector that accumulates the input elements into a new SynchronizedIndexedSet with specified int indexer.
 This is an concurrent and unordered Collector.public static <V> Collector<V,?,? extends SynchronizedIndexedSet<Long,V>> collectorLong(IndexerFunction.LongKey<? super V> indexer)
Collector that accumulates the input elements into a new SynchronizedIndexedSet with specified long indexer.
 This is an concurrent and unordered Collector.@Deprecated public static <V> Collector<V,?,? extends SynchronizedIndexedSet<Integer,V>> collector(IndexerFunction.IntKey<? super V> indexer)
collectorInt(indexer)Collector that accumulates the input elements into a new SynchronizedIndexedSet with specified indexer.
 This is an concurrent and unordered Collector.@Deprecated public static <V> Collector<V,?,? extends SynchronizedIndexedSet<Long,V>> collector(IndexerFunction.LongKey<? super V> indexer)
collectorLong(indexer)Collector that accumulates the input elements into a new SynchronizedIndexedSet with specified indexer.
 This is an concurrent and unordered Collector.public SynchronizedIndexedSet<K,V> clone()
clone in class IndexedSet<K,V>public SynchronizedIndexedSet<K,V> withCapacity(int capacity)
Returns this set instance for convenience.
withCapacity in class IndexedSet<K,V>public SynchronizedIndexedSet<K,V> withElements(Collection<? extends V> c)
Returns this set instance for convenience.
withElements in class IndexedSet<K,V>public void ensureCapacity(int capacity)
ensureCapacity in class IndexedSet<K,V>public void trimToSize()
trimToSize in class IndexedSet<K,V>public void clear()
clear in interface Collection<V>clear in interface Set<V>clear in class IndexedSet<K,V>public IndexedSetStats getStats()
getStats in class IndexedSet<K,V>public V put(V value)
put in class IndexedSet<K,V>public V putIfAbsentAndGet(V value)
   if (set.containsValue(value)) {
     return set.getByValue(value);
   } else {
     set.put(value);
     return value;
   }
 
 except that the action is performed atomically if it is properly synchronized.
 
 Note, that unlike ConcurrentMap.putIfAbsent(K, V),
 this method returns specified value (not null) if the value was absent.
putIfAbsentAndGet in class IndexedSet<K,V>public V removeValue(V value)
removeValue in class IndexedSet<K,V>public V removeKey(K key)
removeKey in class IndexedSet<K,V>public V removeKey(long key)
removeKey in class IndexedSet<K,V>public boolean addAll(Collection<? extends V> c)
AbstractConcurrentSet
 This implementation iterates all elements of specified collection and adds
 them one-by-one using add(element) method.
addAll in interface Collection<V>addAll in interface Set<V>addAll in class AbstractConcurrentSet<V>public boolean removeAll(Collection<?> c)
IndexedSet
 Elements compared using the set's IndexerFunction.
removeAll in interface Collection<V>removeAll in interface Set<V>removeAll in class IndexedSet<K,V>c - collection containing elements to be removed from this setpublic boolean retainAll(Collection<?> c)
IndexedSet
 Elements compared using the set's IndexerFunction.
 
 NOTE: if provided collection is not an IndexedSet with the same IndexerFunction this
 implementation will create a temporary IndexedSet with provided elements.
retainAll in interface Collection<V>retainAll in interface Set<V>retainAll in class IndexedSet<K,V>c - collection containing elements to be retained in this setCopyright © 2002–2025 Devexperts LLC. All rights reserved.