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)
boolean
allSatisfy(Predicate<? super T> predicate)
boolean
anySatisfy(Predicate<? super T> predicate)
ParallelListIterable<T>
asParallel(ExecutorService executorService, int batchSize)
MutableList<T>
asSynchronized()
MutableList<T>
asUnmodifiable()
MutableList<T>
clone()
<S> boolean
corresponds(OrderedIterable<S> other, Predicate2<? super T,? super S> predicate)
int
count(Predicate<? super T> predicate)
T
detect(Predicate<? super T> predicate)
T
detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
int
detectIndex(Predicate<? super T> predicate)
int
detectLastIndex(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)
void
each(Procedure<? super T> procedure)
void
forEach(int fromIndex, int toIndex, Procedure<? super T> procedure)
void
forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)
void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
<IV> IV
injectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)
MutableList<T>
newEmpty()
Deprecated.useFastList.newList()
instead (inlineable)boolean
noneSatisfy(Predicate<? super T> predicate)
PartitionMutableList<T>
partitionWhile(Predicate<? super T> predicate)
void
reverseForEach(Procedure<? super T> procedure)
void
reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)
<S> MutableList<S>
selectInstancesOf(Class<S> clazz)
void
sort(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:
toImmutable
in interfaceListIterable<T>
- Specified by:
toImmutable
in interfaceMutableCollection<T>
- Specified by:
toImmutable
in interfaceMutableList<T>
-
asUnmodifiable
public MutableList<T> asUnmodifiable()
- Specified by:
asUnmodifiable
in interfaceMutableCollection<T>
- Specified by:
asUnmodifiable
in interfaceMutableList<T>
-
asSynchronized
public MutableList<T> asSynchronized()
- Specified by:
asSynchronized
in interfaceMutableCollection<T>
- Specified by:
asSynchronized
in interfaceMutableList<T>
-
clone
public MutableList<T> clone()
- Specified by:
clone
in interfaceMutableList<T>
- Overrides:
clone
in classAbstractListAdapter<T>
-
newEmpty
@Deprecated public MutableList<T> newEmpty()
Deprecated.useFastList.newList()
instead (inlineable)- Specified by:
newEmpty
in interfaceMutableCollection<T>
- Specified by:
newEmpty
in interfaceMutableList<T>
-
each
public void each(Procedure<? super T> procedure)
- Specified by:
each
in interfaceRichIterable<T>
- Overrides:
each
in classAbstractCollectionAdapter<T>
-
reverseForEach
public void reverseForEach(Procedure<? super T> procedure)
- Specified by:
reverseForEach
in interfaceReversibleIterable<T>
-
reverseForEachWithIndex
public void reverseForEachWithIndex(ObjectIntProcedure<? super T> procedure)
- Specified by:
reverseForEachWithIndex
in interfaceReversibleIterable<T>
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
- Specified by:
forEachWithIndex
in interfaceInternalIterable<T>
- Specified by:
forEachWithIndex
in interfaceOrderedIterable<T>
- Overrides:
forEachWithIndex
in classAbstractCollectionAdapter<T>
-
forEachWithIndex
public void forEachWithIndex(int fromIndex, int toIndex, ObjectIntProcedure<? super T> objectIntProcedure)
- Specified by:
forEachWithIndex
in interfaceOrderedIterable<T>
-
detect
public T detect(Predicate<? super T> predicate)
- Specified by:
detect
in interfaceRichIterable<T>
- Overrides:
detect
in classAbstractCollectionAdapter<T>
-
detectIfNone
public T detectIfNone(Predicate<? super T> predicate, Function0<? extends T> function)
- Specified by:
detectIfNone
in interfaceRichIterable<T>
- Overrides:
detectIfNone
in classAbstractCollectionAdapter<T>
-
detectIndex
public int detectIndex(Predicate<? super T> predicate)
- Specified by:
detectIndex
in interfaceOrderedIterable<T>
-
detectLastIndex
public int detectLastIndex(Predicate<? super T> predicate)
- Specified by:
detectLastIndex
in interfaceReversibleIterable<T>
-
count
public int count(Predicate<? super T> predicate)
- Specified by:
count
in interfaceRichIterable<T>
- Overrides:
count
in classAbstractCollectionAdapter<T>
-
corresponds
public <S> boolean corresponds(OrderedIterable<S> other, Predicate2<? super T,? super S> predicate)
- Specified by:
corresponds
in interfaceOrderedIterable<T>
-
anySatisfy
public boolean anySatisfy(Predicate<? super T> predicate)
- Specified by:
anySatisfy
in interfaceRichIterable<T>
- Overrides:
anySatisfy
in classAbstractCollectionAdapter<T>
-
allSatisfy
public boolean allSatisfy(Predicate<? super T> predicate)
- Specified by:
allSatisfy
in interfaceRichIterable<T>
- Overrides:
allSatisfy
in classAbstractCollectionAdapter<T>
-
noneSatisfy
public boolean noneSatisfy(Predicate<? super T> predicate)
- Specified by:
noneSatisfy
in interfaceRichIterable<T>
- Overrides:
noneSatisfy
in classAbstractCollectionAdapter<T>
-
injectInto
public <IV> IV injectInto(IV injectedValue, Function2<? super IV,? super T,? extends IV> function)
- Specified by:
injectInto
in interfaceRichIterable<T>
- Overrides:
injectInto
in classAbstractCollectionAdapter<T>
-
forEach
public void forEach(int fromIndex, int toIndex, Procedure<? super T> procedure)
- Specified by:
forEach
in interfaceOrderedIterable<T>
-
sort
public void sort(Comparator<? super T> comparator)
-
sortThis
public ListAdapter<T> sortThis(Comparator<? super T> comparator)
- Specified by:
sortThis
in interfaceMutableList<T>
- Since:
- 10.0
-
sortThis
public ListAdapter<T> sortThis()
- Specified by:
sortThis
in interfaceMutableList<T>
- Since:
- 10.0
-
with
public ListAdapter<T> with(T element)
- Specified by:
with
in interfaceMutableCollection<T>
- Specified by:
with
in 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:
without
in interfaceMutableCollection<T>
- Specified by:
without
in interfaceMutableList<T>
-
withAll
public ListAdapter<T> withAll(Iterable<? extends T> elements)
- Specified by:
withAll
in interfaceMutableCollection<T>
- Specified by:
withAll
in interfaceMutableList<T>
-
withoutAll
public ListAdapter<T> withoutAll(Iterable<? extends T> elements)
- Specified by:
withoutAll
in interfaceMutableCollection<T>
- Specified by:
withoutAll
in interfaceMutableList<T>
-
selectInstancesOf
public <S> MutableList<S> selectInstancesOf(Class<S> clazz)
- Specified by:
selectInstancesOf
in interfaceListIterable<T>
- Specified by:
selectInstancesOf
in interfaceMutableCollection<T>
- Specified by:
selectInstancesOf
in interfaceMutableList<T>
- Specified by:
selectInstancesOf
in interfaceOrderedIterable<T>
- Specified by:
selectInstancesOf
in interfaceReversibleIterable<T>
- Specified by:
selectInstancesOf
in interfaceRichIterable<T>
- Overrides:
selectInstancesOf
in classAbstractListAdapter<T>
-
distinct
public MutableList<T> distinct()
- Specified by:
distinct
in interfaceListIterable<T>
- Specified by:
distinct
in interfaceMutableList<T>
- Specified by:
distinct
in interfaceOrderedIterable<T>
- Specified by:
distinct
in interfaceReversibleIterable<T>
-
distinct
public MutableList<T> distinct(HashingStrategy<? super T> hashingStrategy)
- Specified by:
distinct
in interfaceListIterable<T>
- Specified by:
distinct
in interfaceMutableList<T>
-
take
public MutableList<T> take(int count)
- Specified by:
take
in interfaceListIterable<T>
- Specified by:
take
in interfaceMutableList<T>
- Specified by:
take
in interfaceReversibleIterable<T>
-
takeWhile
public MutableList<T> takeWhile(Predicate<? super T> predicate)
- Specified by:
takeWhile
in interfaceListIterable<T>
- Specified by:
takeWhile
in interfaceMutableList<T>
- Specified by:
takeWhile
in interfaceOrderedIterable<T>
- Specified by:
takeWhile
in interfaceReversibleIterable<T>
-
drop
public MutableList<T> drop(int count)
- Specified by:
drop
in interfaceListIterable<T>
- Specified by:
drop
in interfaceMutableList<T>
- Specified by:
drop
in interfaceReversibleIterable<T>
-
dropWhile
public MutableList<T> dropWhile(Predicate<? super T> predicate)
- Specified by:
dropWhile
in interfaceListIterable<T>
- Specified by:
dropWhile
in interfaceMutableList<T>
- Specified by:
dropWhile
in interfaceOrderedIterable<T>
- Specified by:
dropWhile
in interfaceReversibleIterable<T>
-
partitionWhile
public PartitionMutableList<T> partitionWhile(Predicate<? super T> predicate)
- Specified by:
partitionWhile
in interfaceListIterable<T>
- Specified by:
partitionWhile
in interfaceMutableList<T>
- Specified by:
partitionWhile
in interfaceOrderedIterable<T>
- Specified by:
partitionWhile
in interfaceReversibleIterable<T>
-
asParallel
public ParallelListIterable<T> asParallel(ExecutorService executorService, int batchSize)
- Specified by:
asParallel
in interfaceListIterable<T>
- Overrides:
asParallel
in classAbstractListAdapter<T>
-
-