Class ListAdapter<T>
- java.lang.Object
-
- org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter<T>
-
- org.eclipse.collections.impl.list.mutable.AbstractListAdapter<T>
-
- org.eclipse.collections.impl.list.mutable.ListAdapter<T>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<T>,Collection<T>,List<T>,MutableCollection<T>,InternalIterable<T>,ListIterable<T>,MutableList<T>,OrderedIterable<T>,ReversibleIterable<T>,RichIterable<T>
public final class ListAdapter<T> extends AbstractListAdapter<T> implements Serializable
This class provides a MutableList wrapper around a JDK Collections List interface instance. All the MutableList interface methods are supported in addition to the JDK List interface methods.To create a new wrapper around an existing List instance, use the
adapt(List)factory method.- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <E> MutableList<E>adapt(List<E> list)booleanallSatisfy(Predicate<? super T> predicate)booleananySatisfy(Predicate<? super T> predicate)ParallelListIterable<T>asParallel(ExecutorService executorService, int batchSize)MutableList<T>asSynchronized()MutableList<T>asUnmodifiable()MutableList<T>clone()<S> booleancorresponds(OrderedIterable<S> other, Predicate2<? super T,? super S> predicate)intcount(Predicate<? super T> predicate)Tdetect(Predicate<? super T> predicate)TdetectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)intdetectIndex(Predicate<? super T> predicate)intdetectLastIndex(Predicate<? super T> predicate)MutableList<T>distinct()MutableList<T>distinct(HashingStrategy<? super T> hashingStrategy)MutableList<T>drop(int count)MutableList<T>dropWhile(Predicate<? super T> predicate)voideach(Procedure<? super T> procedure)voidforEach(int fromIndex, int toIndex, Procedure<? super T> procedure)voidforEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)voidforEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)<IV> IVinjectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)MutableList<T>newEmpty()Deprecated.useFastList.newList()instead (inlineable)booleannoneSatisfy(Predicate<? super T> predicate)PartitionMutableList<T>partitionWhile(Predicate<? super T> predicate)voidreverseForEach(Procedure<? super T> procedure)voidreverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)<S> MutableList<S>selectInstancesOf(Class<S> clazz)voidsort(Comparator<? super T> comparator)ListAdapter<T>sortThis()ListAdapter<T>sortThis(Comparator<? super T> comparator)MutableList<T>take(int count)MutableList<T>takeWhile(Predicate<? super T> predicate)ImmutableList<T>toImmutable()ListAdapter<T>with(T element)ListAdapter<T>with(T... elements)ListAdapter<T>with(T element1, T element2)ListAdapter<T>with(T element1, T element2, T element3)ListAdapter<T>withAll(Iterable<? extends T> elements)ListAdapter<T>without(T element)ListAdapter<T>withoutAll(Iterable<? extends T> elements)-
Methods inherited from class org.eclipse.collections.impl.list.mutable.AbstractListAdapter
add, addAll, asReversed, collect, collectIf, collectWith, distinctBy, equals, flatCollect, get, groupBy, groupByEach, hashCode, indexOf, lastIndexOf, listIterator, listIterator, partition, partitionWith, reject, rejectWith, remove, select, selectWith, set, sortThisByBoolean, sortThisByByte, sortThisByChar, sortThisByDouble, sortThisByFloat, sortThisByInt, sortThisByLong, sortThisByShort, subList, tap, toStack, zip, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractCollectionAdapter
add, addAll, addAllIterable, allSatisfyWith, anySatisfyWith, appendString, asLazy, chunk, clear, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, countWith, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEachWith, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectIntoWith, into, isEmpty, iterator, max, max, maxBy, min, min, minBy, noneSatisfyWith, notEmpty, reject, rejectWith, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, select, selectAndRejectWith, selectWith, size, sumByDouble, sumByFloat, sumByInt, sumByLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedList, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toString, zip, zipWithIndex
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith
-
Methods inherited from interface java.util.List
add, addAll, clear, contains, containsAll, isEmpty, iterator, remove, removeAll, replaceAll, retainAll, size, spliterator, toArray, toArray
-
Methods inherited from interface org.eclipse.collections.api.list.ListIterable
binarySearch, binarySearch, forEachInBoth
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, groupByUniqueKey, injectIntoWith, removeAllIterable, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.list.MutableList
collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, collectWithIndex, flatCollectWith, getFirst, getLast, rejectWithIndex, reverseThis, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, toImmutableList, toReversed
-
Methods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
collectWithIndex, getFirstOptional, getLastOptional, max, min, rejectWithIndex, selectWithIndex, zip, zipWithIndex
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfyWith, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, countBy, countByEach, countByWith, countWith, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, maxBy, maxByOptional, maxOptional, maxOptional, min, minBy, minByOptional, minOptional, minOptional, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString
-
-
-
-
Method Detail
-
adapt
public static <E> MutableList<E> adapt(List<E> list)
-
toImmutable
public ImmutableList<T> toImmutable()
- Specified by:
toImmutablein interfaceListIterable<T>- Specified by:
toImmutablein interfaceMutableCollection<T>- Specified by:
toImmutablein interfaceMutableList<T>
-
asUnmodifiable
public MutableList<T> asUnmodifiable()
- Specified by:
asUnmodifiablein interfaceMutableCollection<T>- Specified by:
asUnmodifiablein interfaceMutableList<T>
-
asSynchronized
public MutableList<T> asSynchronized()
- Specified by:
asSynchronizedin interfaceMutableCollection<T>- Specified by:
asSynchronizedin interfaceMutableList<T>
-
clone
public MutableList<T> clone()
- Specified by:
clonein interfaceMutableList<T>- Overrides:
clonein classAbstractListAdapter<T>
-
newEmpty
@Deprecated public MutableList<T> newEmpty()
Deprecated.useFastList.newList()instead (inlineable)- Specified by:
newEmptyin interfaceMutableCollection<T>- Specified by:
newEmptyin interfaceMutableList<T>
-
each
public void each(Procedure<? super T> procedure)
- Specified by:
eachin interfaceRichIterable<T>- Overrides:
eachin classAbstractCollectionAdapter<T>
-
reverseForEach
public void reverseForEach(Procedure<? super T> procedure)
- Specified by:
reverseForEachin interfaceReversibleIterable<T>
-
reverseForEachWithIndex
public void reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)
- Specified by:
reverseForEachWithIndexin interfaceReversibleIterable<T>
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
- Specified by:
forEachWithIndexin interfaceInternalIterable<T>- Specified by:
forEachWithIndexin interfaceOrderedIterable<T>- Overrides:
forEachWithIndexin classAbstractCollectionAdapter<T>
-
forEachWithIndex
public void forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)- Specified by:
forEachWithIndexin interfaceOrderedIterable<T>
-
detect
public T detect(Predicate<? super T> predicate)
- Specified by:
detectin interfaceRichIterable<T>- Overrides:
detectin classAbstractCollectionAdapter<T>
-
detectIfNone
public T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
- Specified by:
detectIfNonein interfaceRichIterable<T>- Overrides:
detectIfNonein classAbstractCollectionAdapter<T>
-
detectIndex
public int detectIndex(Predicate<? super T> predicate)
- Specified by:
detectIndexin interfaceOrderedIterable<T>
-
detectLastIndex
public int detectLastIndex(Predicate<? super T> predicate)
- Specified by:
detectLastIndexin interfaceReversibleIterable<T>
-
count
public int count(Predicate<? super T> predicate)
- Specified by:
countin interfaceRichIterable<T>- Overrides:
countin classAbstractCollectionAdapter<T>
-
corresponds
public <S> boolean corresponds(OrderedIterable<S> other, Predicate2<? super T,? super S> predicate)
- Specified by:
correspondsin interfaceOrderedIterable<T>
-
anySatisfy
public boolean anySatisfy(Predicate<? super T> predicate)
- Specified by:
anySatisfyin interfaceRichIterable<T>- Overrides:
anySatisfyin classAbstractCollectionAdapter<T>
-
allSatisfy
public boolean allSatisfy(Predicate<? super T> predicate)
- Specified by:
allSatisfyin interfaceRichIterable<T>- Overrides:
allSatisfyin classAbstractCollectionAdapter<T>
-
noneSatisfy
public boolean noneSatisfy(Predicate<? super T> predicate)
- Specified by:
noneSatisfyin interfaceRichIterable<T>- Overrides:
noneSatisfyin classAbstractCollectionAdapter<T>
-
injectInto
public <IV> IV injectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)- Specified by:
injectIntoin interfaceRichIterable<T>- Overrides:
injectIntoin classAbstractCollectionAdapter<T>
-
forEach
public void forEach(int fromIndex, int toIndex, Procedure<? super T> procedure)- Specified by:
forEachin interfaceOrderedIterable<T>
-
sort
public void sort(Comparator<? super T> comparator)
-
sortThis
public ListAdapter<T> sortThis(Comparator<? super T> comparator)
- Specified by:
sortThisin interfaceMutableList<T>- Since:
- 10.0
-
sortThis
public ListAdapter<T> sortThis()
- Specified by:
sortThisin interfaceMutableList<T>- Since:
- 10.0
-
with
public ListAdapter<T> with(T element)
- Specified by:
within interfaceMutableCollection<T>- Specified by:
within interfaceMutableList<T>
-
with
public ListAdapter<T> with(T element1, T element2)
-
with
public ListAdapter<T> with(T element1, T element2, T element3)
-
with
public ListAdapter<T> with(T... elements)
-
without
public ListAdapter<T> without(T element)
- Specified by:
withoutin interfaceMutableCollection<T>- Specified by:
withoutin interfaceMutableList<T>
-
withAll
public ListAdapter<T> withAll(Iterable<? extends T> elements)
- Specified by:
withAllin interfaceMutableCollection<T>- Specified by:
withAllin interfaceMutableList<T>
-
withoutAll
public ListAdapter<T> withoutAll(Iterable<? extends T> elements)
- Specified by:
withoutAllin interfaceMutableCollection<T>- Specified by:
withoutAllin interfaceMutableList<T>
-
selectInstancesOf
public <S> MutableList<S> selectInstancesOf(Class<S> clazz)
- Specified by:
selectInstancesOfin interfaceListIterable<T>- Specified by:
selectInstancesOfin interfaceMutableCollection<T>- Specified by:
selectInstancesOfin interfaceMutableList<T>- Specified by:
selectInstancesOfin interfaceOrderedIterable<T>- Specified by:
selectInstancesOfin interfaceReversibleIterable<T>- Specified by:
selectInstancesOfin interfaceRichIterable<T>- Overrides:
selectInstancesOfin classAbstractListAdapter<T>
-
distinct
public MutableList<T> distinct()
- Specified by:
distinctin interfaceListIterable<T>- Specified by:
distinctin interfaceMutableList<T>- Specified by:
distinctin interfaceOrderedIterable<T>- Specified by:
distinctin interfaceReversibleIterable<T>
-
distinct
public MutableList<T> distinct(HashingStrategy<? super T> hashingStrategy)
- Specified by:
distinctin interfaceListIterable<T>- Specified by:
distinctin interfaceMutableList<T>
-
take
public MutableList<T> take(int count)
- Specified by:
takein interfaceListIterable<T>- Specified by:
takein interfaceMutableList<T>- Specified by:
takein interfaceReversibleIterable<T>
-
takeWhile
public MutableList<T> takeWhile(Predicate<? super T> predicate)
- Specified by:
takeWhilein interfaceListIterable<T>- Specified by:
takeWhilein interfaceMutableList<T>- Specified by:
takeWhilein interfaceOrderedIterable<T>- Specified by:
takeWhilein interfaceReversibleIterable<T>
-
drop
public MutableList<T> drop(int count)
- Specified by:
dropin interfaceListIterable<T>- Specified by:
dropin interfaceMutableList<T>- Specified by:
dropin interfaceReversibleIterable<T>
-
dropWhile
public MutableList<T> dropWhile(Predicate<? super T> predicate)
- Specified by:
dropWhilein interfaceListIterable<T>- Specified by:
dropWhilein interfaceMutableList<T>- Specified by:
dropWhilein interfaceOrderedIterable<T>- Specified by:
dropWhilein interfaceReversibleIterable<T>
-
partitionWhile
public PartitionMutableList<T> partitionWhile(Predicate<? super T> predicate)
- Specified by:
partitionWhilein interfaceListIterable<T>- Specified by:
partitionWhilein interfaceMutableList<T>- Specified by:
partitionWhilein interfaceOrderedIterable<T>- Specified by:
partitionWhilein interfaceReversibleIterable<T>
-
asParallel
public ParallelListIterable<T> asParallel(ExecutorService executorService, int batchSize)
- Specified by:
asParallelin interfaceListIterable<T>- Overrides:
asParallelin classAbstractListAdapter<T>
-
-