Class CollectionAdapter<T>
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter<T>
-
- org.eclipse.collections.impl.collection.mutable.CollectionAdapter<T>
-
- All Implemented Interfaces:
Serializable,Iterable<T>,Collection<T>,MutableCollection<T>,InternalIterable<T>,RichIterable<T>
public final class CollectionAdapter<T> extends AbstractCollectionAdapter<T> implements Serializable
This class provides a MutableCollection interface wrapper around a JDK Collections Collection interface instance. All the MutableCollection interface methods are supported in addition to the JDK Collection interface methods.To create a new instance that wraps a collection with the MutableSet interface, use the
wrapSet(Iterable)factory method. To create a new instance that wraps a collection with the MutableList interface, use thewrapList(Iterable)factory method. To wrap a collection with the MutableCollection interface alone, use theadapt(Collection)factory method.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CollectionAdapter(Collection<T> newDelegate)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> MutableCollection<E>adapt(Collection<E> collection)MutableCollection<T>asSynchronized()MutableCollection<T>asUnmodifiable()booleanequals(Object o)inthashCode()MutableCollection<T>newEmpty()Deprecated.useFastList.newList()orUnifiedSet.newSet()insteadImmutableCollection<T>toImmutable()CollectionAdapter<T>with(T element)CollectionAdapter<T>with(T... elements)CollectionAdapter<T>withAll(Iterable<? extends T> elements)CollectionAdapter<T>without(T element)CollectionAdapter<T>withoutAll(Iterable<? extends T> elements)static <E> MutableList<E>wrapList(Iterable<E> iterable)static <E> MutableSet<E>wrapSet(Iterable<E> iterable)-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter
add, addAll, addAllIterable, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, asLazy, chunk, clear, collect, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectIf, collectInt, collectLong, collectShort, collectWith, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollect, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupBy, groupByEach, groupByEach, groupByUniqueKey, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, into, isEmpty, iterator, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, notEmpty, partition, partitionWith, reject, reject, rejectWith, rejectWith, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, select, select, selectAndRejectWith, selectInstancesOf, selectWith, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, tap, toArray, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedList, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toString, zip, zip, zipWithIndex, zipWithIndex
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, spliterator, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
aggregateBy, aggregateInPlaceBy, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, countBy, countByEach, countByWith, flatCollectWith
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, appendString, appendString, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, countBy, countByEach, countByWith, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, groupByAndCollect, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, makeString, makeString, makeString, makeString, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, reduce, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toSortedBagBy, toSortedList, toSortedListBy, toSortedMapBy, toSortedSetBy
-
-
-
-
Constructor Detail
-
CollectionAdapter
public CollectionAdapter(Collection<T> newDelegate)
-
-
Method Detail
-
asUnmodifiable
public MutableCollection<T> asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableCollection<T>
-
asSynchronized
public MutableCollection<T> asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableCollection<T>
-
toImmutable
public ImmutableCollection<T> toImmutable()
- Specified by:
toImmutablein interfaceMutableCollection<T>
-
wrapSet
public static <E> MutableSet<E> wrapSet(Iterable<E> iterable)
-
wrapList
public static <E> MutableList<E> wrapList(Iterable<E> iterable)
-
adapt
public static <E> MutableCollection<E> adapt(Collection<E> collection)
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<T>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<T>- Overrides:
hashCodein classObject
-
with
public CollectionAdapter<T> with(T... elements)
-
with
public CollectionAdapter<T> with(T element)
- Specified by:
within interfaceMutableCollection<T>
-
without
public CollectionAdapter<T> without(T element)
- Specified by:
withoutin interfaceMutableCollection<T>
-
withAll
public CollectionAdapter<T> withAll(Iterable<? extends T> elements)
- Specified by:
withAllin interfaceMutableCollection<T>
-
withoutAll
public CollectionAdapter<T> withoutAll(Iterable<? extends T> elements)
- Specified by:
withoutAllin interfaceMutableCollection<T>
-
newEmpty
@Deprecated public MutableCollection<T> newEmpty()
Deprecated.useFastList.newList()orUnifiedSet.newSet()instead- Specified by:
newEmptyin interfaceMutableCollection<T>
-
-