java.io.Serializable, java.lang.Iterable<T>, java.util.Collection<T>, MutableCollection<T>, InternalIterable<T>, RichIterable<T>public class SynchronizedMutableCollection<T> extends AbstractSynchronizedMutableCollection<T> implements java.io.Serializable
MutableCollection. It is imperative that the user manually synchronize on the collection when iterating over it using the
 standard JDK iterator or JDK 5 for loop, as per Collections.synchronizedCollection(Collection).| Modifier and Type | Method | Description | 
|---|---|---|
| MutableCollection<T> | asSynchronized() | Returns a synchronized wrapper backed by this collection. | 
| MutableCollection<T> | asUnmodifiable() | Returns an unmodifiable view of this collection. | 
| MutableCollection<T> | newEmpty() | Creates a new empty mutable version of the same collection type. | 
| static <E,C extends java.util.Collection<E>> | of(C collection) | This method will take a MutableCollection and wrap it directly in a SynchronizedMutableCollection. | 
| static <E,C extends java.util.Collection<E>> | of(C collection,
  java.lang.Object lock) | This method will take a MutableCollection and wrap it directly in a SynchronizedMutableCollection. | 
| ImmutableCollection<T> | toImmutable() | Converts this  MutableCollectionto anImmutableCollection. | 
| MutableCollection<T> | with(T element) | This method allows mutable and fixed size collections the ability to add elements to their existing elements. | 
| MutableCollection<T> | withAll(java.lang.Iterable<? extends T> elements) | This method allows mutable and fixed size collections the ability to add multiple elements to their existing
 elements. | 
| MutableCollection<T> | without(T element) | This method allows mutable and fixed size collections the ability to remove elements from their existing elements. | 
| MutableCollection<T> | withoutAll(java.lang.Iterable<? extends T> elements) | This method allows mutable and fixed size collections the ability to remove multiple elements from their existing
 elements. | 
add, addAll, addAllIterable, aggregateBy, aggregateInPlaceBy, clear, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, countBy, countByWith, flatCollect, groupBy, groupByEach, groupByUniqueKey, injectIntoWith, partition, partitionWith, reject, rejectWith, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, select, selectAndRejectWith, selectInstancesOf, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, tap, zip, zipWithIndexallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, equals, flatCollect, forEach, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, hashCode, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, iterator, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reject, rejectWith, select, selectWith, size, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexcontains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeIf, size, spliterator, stream, toArray, toArrayforEach, forEach, forEachWith, forEachWithIndexflatCollectWithallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectWith, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexpublic static <E,C extends java.util.Collection<E>> SynchronizedMutableCollection<E> of(C collection)
public static <E,C extends java.util.Collection<E>> SynchronizedMutableCollection<E> of(C collection, java.lang.Object lock)
public MutableCollection<T> with(T element)
MutableCollection
 MutableCollection<String> list = list.with("1");
 list = list.with("2");
 return list;
 
 In the case of FixedSizeCollection a new instance of MutableCollection will be returned by with, and any
 variables that previously referenced the original collection will need to be redirected to reference the
 new instance.  For other MutableCollection types you will replace the reference to collection with the same
 collection, since the instance will return "this" after calling add on itself.with in interface MutableCollection<T>Collection.add(Object)public MutableCollection<T> without(T element)
MutableCollection
 MutableCollection<String> list = list.without("1");
 list = list.without("2");
 return list;
 
 In the case of FixedSizeCollection a new instance of MutableCollection will be returned by without, and
 any variables that previously referenced the original collection will need to be redirected to reference the
 new instance.  For other MutableCollection types you will replace the reference to collection with the same
 collection, since the instance will return "this" after calling remove on itself.without in interface MutableCollection<T>Collection.remove(Object)public MutableCollection<T> withAll(java.lang.Iterable<? extends T> elements)
MutableCollection
 MutableCollection<String> list = list.withAll(FastList.newListWith("1", "2"));
 
 In the case of FixedSizeCollection a new instance of MutableCollection will be returned by withAll, and
 any variables that previously referenced the original collection will need to be redirected to reference the
 new instance.  For other MutableCollection types you will replace the reference to collection with the same
 collection, since the instance will return "this" after calling addAll on itself.withAll in interface MutableCollection<T>Collection.addAll(Collection)public MutableCollection<T> withoutAll(java.lang.Iterable<? extends T> elements)
MutableCollection
 MutableCollection<String> list = list.withoutAll(FastList.newListWith("1", "2"));
 
 In the case of FixedSizeCollection a new instance of MutableCollection will be returned by withoutAll,
 and any variables that previously referenced the original collection will need to be redirected to reference the
 new instance.  For other MutableCollection types you will replace the reference to collection with the same
 collection, since the instance will return "this" after calling removeAll on itself.withoutAll in interface MutableCollection<T>Collection.removeAll(Collection)public MutableCollection<T> asUnmodifiable()
MutableCollectionCollections.unmodifiableCollection(this) with a return type that supports the full
 iteration protocols available on MutableCollection.  Methods which would
 mutate the underlying collection will throw UnsupportedOperationExceptions.asUnmodifiable in interface MutableCollection<T>Collections.unmodifiableCollection(Collection)public MutableCollection<T> asSynchronized()
MutableCollectionCollections.synchronizedCollection(this) only with a return type that supports the full
 iteration protocols available on MutableCollection.
 The preferred way of iterating over a synchronized collection is to use the internal iteration
 methods which are properly synchronized internally.
 
  MutableCollection synchedCollection = collection.asSynchronized();
     ...
  synchedCollection.forEach(each -> ... );
  synchedCollection.select(each -> ... );
  synchedCollection.collect(each -> ... );
 
 If you want to iterate using an imperative style, you must protect external iterators using
 a synchronized block.  This includes explicit iterators as well as JDK 5 style for loops.
 asSynchronized in interface MutableCollection<T>Collections.synchronizedCollection(Collection)public ImmutableCollection<T> toImmutable()
MutableCollectionMutableCollection to an ImmutableCollection.toImmutable in interface MutableCollection<T>public MutableCollection<T> newEmpty()
MutableCollectionnewEmpty in interface MutableCollection<T>Copyright © 2004–2018. All rights reserved.