Class CompositeFastList<E>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection<T>
-
- org.eclipse.collections.impl.list.mutable.AbstractMutableList<E>
-
- org.eclipse.collections.impl.list.mutable.CompositeFastList<E>
-
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<E>,Collection<E>,List<E>,MutableCollection<E>,InternalIterable<E>,ListIterable<E>,MutableList<E>,OrderedIterable<E>,ReversibleIterable<E>,RichIterable<E>,BatchIterable<E>
public final class CompositeFastList<E> extends AbstractMutableList<E> implements BatchIterable<E>, Serializable
CompositeFastList behaves like a list, but is composed of at least one list. It is useful where you don't want the additional expense of appending several lists or allocating memory for a super list to add multiple sublists to.Note: mutation operations (e.g. add and remove, sorting) will change the underlying lists - so be sure to only use a composite list where it will be the only reference to the sublists (for example, a composite list which contains multiple query results is OK as long as it is the only thing that references the lists)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CompositeFastList()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, E element)booleanadd(E object)booleanaddAll(int index, Collection<? extends E> collection)booleanaddAll(Collection<? extends E> collection)voidaddComposited(Collection<? extends E> collection)booleanallSatisfy(Predicate<? super E> predicate)<P> booleanallSatisfyWith(Predicate2<? super E,? super P> predicate, P parameter)booleananySatisfy(Predicate<? super E> predicate)<P> booleananySatisfyWith(Predicate2<? super E,? super P> predicate, P parameter)ParallelListIterable<E>asParallel(ExecutorService executorService, int batchSize)voidbatchForEach(Procedure<? super E> procedure, int sectionIndex, int sectionCount)voidclear()MutableList<E>clone()<V,R extends Collection<V>>
Rcollect(Function<? super E,? extends V> function, R target)<P,A,R extends Collection<A>>
RcollectWith(Function2<? super E,? super P,? extends A> function, P parameter, R target)booleancontains(Object object)booleancontainsAll(Collection<?> collection)intcount(Predicate<? super E> predicate)<P> intcountWith(Predicate2<? super E,? super P> predicate, P parameter)voideach(Procedure<? super E> procedure)<P> voidforEachWith(Procedure2<? super E,? super P> procedure2, P parameter)voidforEachWithIndex(ObjectIntProcedure<? super E> objectIntProcedure)Eget(int index)intgetBatchCount(int batchSize)intindexOf(Object o)doubleinjectInto(double injectedValue, DoubleObjectToDoubleFunction<? super E> function)floatinjectInto(float injectedValue, FloatObjectToFloatFunction<? super E> function)intinjectInto(int injectedValue, IntObjectToIntFunction<? super E> function)longinjectInto(long injectedValue, LongObjectToLongFunction<? super E> function)<IV> IVinjectInto(IV injectedValue, Function2<? super IV,? super E,? extends IV> function)booleanisEmpty()Iterator<E>iterator()intlastIndexOf(Object o)ListIterator<E>listIterator()a list iterator is a problem for a composite list as going back in the order of the list is an issue, as are the other methods like set() and add() (and especially, remove).ListIterator<E>listIterator(int index)a list iterator is a problem for a composite list as going back in the order of the list is an issue, as are the other methods like set() and add() (and especially, remove).booleannoneSatisfy(Predicate<? super E> predicate)<P> booleannoneSatisfyWith(Predicate2<? super E,? super P> predicate, P parameter)<R extends Collection<E>>
Rreject(Predicate<? super E> predicate, R target)<P,R extends Collection<E>>
RrejectWith(Predicate2<? super E,? super P> predicate, P parameter, R target)Eremove(int index)booleanremove(Object object)booleanremoveAll(Collection<?> collection)voidreplaceAll(UnaryOperator<E> operator)voidresetSize()booleanretainAll(Collection<?> collection)voidreverseForEach(Procedure<? super E> procedure)voidreverseForEachWithIndex(ObjectIntProcedure<? super E> procedure)CompositeFastList<E>reverseThis()<R extends Collection<E>>
Rselect(Predicate<? super E> predicate, R target)<P,R extends Collection<E>>
RselectWith(Predicate2<? super E,? super P> predicate, P parameter, R target)Eset(int index, E element)intsize()voidsort(Comparator<? super E> comparator)Object[]toArray()Object[]toArray(Object[] array)-
Methods inherited from class org.eclipse.collections.impl.list.mutable.AbstractMutableList
appendString, appendString, asReversed, asSynchronized, asUnmodifiable, binarySearch, chunk, collectIf, corresponds, detect, detectIndex, detectLastIndex, detectOptional, detectWith, detectWithOptional, distinct, distinct, distinctBy, drop, dropWhile, equals, flatCollect, forEach, forEachWithIndex, getFirst, getLast, groupBy, groupByEach, groupByUniqueKey, hashCode, injectIntoWith, max, max, maxBy, min, min, minBy, newEmpty, partition, partitionWhile, partitionWith, removeIf, removeIfWith, selectAndRejectWith, selectInstancesOf, sortThisByBoolean, sortThisByByte, sortThisByChar, sortThisByDouble, sortThisByFloat, sortThisByInt, sortThisByLong, sortThisByShort, subList, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, take, takeWhile, tap, toSet, toSortedList, zip, zip, zipWithIndex, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection
addAllIterable, countBy, countByEach, countByWith, reduce, removeAllIterable, retainAllIterable, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
asLazy, containsAllArguments, containsAllIterable, detectWithIfNone, forEach, groupBy, groupByEach, groupByUniqueKey, into, toBag, toBiMap, toList, toMap, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString
-
Methods inherited from interface org.eclipse.collections.impl.parallel.BatchIterable
forEach
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface java.util.List
spliterator
-
Methods inherited from interface org.eclipse.collections.api.list.ListIterable
binarySearch, forEachInBoth
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, removeAllIterable, retainAllIterable, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.list.MutableList
collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, collectWithIndex, flatCollect, flatCollectWith, reject, rejectWith, rejectWithIndex, select, selectWith, selectWithIndex, shuffleThis, shuffleThis, sortThis, sortThis, sortThisBy, toImmutable, toImmutableList, toReversed, with, withAll, without, withoutAll
-
Methods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
collectWithIndex, getFirstOptional, getLastOptional, rejectWithIndex, selectWithIndex, toStack
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, appendString, asLazy, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, countBy, countByEach, countByWith, detectIfNone, detectWithIfNone, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, makeString, makeString, makeString, makeString, maxByOptional, maxOptional, maxOptional, minByOptional, minOptional, minOptional, notEmpty, reduce, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableMap, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString
-
-
-
-
Method Detail
-
clone
public MutableList<E> clone()
- Specified by:
clonein interfaceMutableList<E>- Overrides:
clonein classAbstractMutableList<E>
-
size
public int size()
- Specified by:
sizein interfaceBatchIterable<E>- Specified by:
sizein interfaceCollection<E>- Specified by:
sizein interfaceList<E>- Specified by:
sizein interfaceRichIterable<E>
-
resetSize
public void resetSize()
-
batchForEach
public void batchForEach(Procedure<? super E> procedure, int sectionIndex, int sectionCount)
- Specified by:
batchForEachin interfaceBatchIterable<E>
-
getBatchCount
public int getBatchCount(int batchSize)
- Specified by:
getBatchCountin interfaceBatchIterable<E>
-
reverseThis
public CompositeFastList<E> reverseThis()
- Specified by:
reverseThisin interfaceMutableList<E>
-
each
public void each(Procedure<? super E> procedure)
- Specified by:
eachin interfaceRichIterable<E>- Overrides:
eachin classAbstractMutableList<E>
-
injectInto
public <IV> IV injectInto(IV injectedValue, Function2<? super IV,? super E,? extends IV> function)- Specified by:
injectIntoin interfaceRichIterable<E>- Overrides:
injectIntoin classAbstractMutableList<E>
-
injectInto
public int injectInto(int injectedValue, IntObjectToIntFunction<? super E> function)- Specified by:
injectIntoin interfaceRichIterable<E>- Overrides:
injectIntoin classAbstractMutableList<E>
-
injectInto
public float injectInto(float injectedValue, FloatObjectToFloatFunction<? super E> function)- Specified by:
injectIntoin interfaceRichIterable<E>- Overrides:
injectIntoin classAbstractMutableList<E>
-
injectInto
public long injectInto(long injectedValue, LongObjectToLongFunction<? super E> function)- Specified by:
injectIntoin interfaceRichIterable<E>- Overrides:
injectIntoin classAbstractMutableList<E>
-
injectInto
public double injectInto(double injectedValue, DoubleObjectToDoubleFunction<? super E> function)- Specified by:
injectIntoin interfaceRichIterable<E>- Overrides:
injectIntoin classAbstractRichIterable<E>
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super E> objectIntProcedure)
- Specified by:
forEachWithIndexin interfaceInternalIterable<E>- Specified by:
forEachWithIndexin interfaceOrderedIterable<E>- Overrides:
forEachWithIndexin classAbstractMutableList<E>
-
reverseForEach
public void reverseForEach(Procedure<? super E> procedure)
- Specified by:
reverseForEachin interfaceReversibleIterable<E>
-
reverseForEachWithIndex
public void reverseForEachWithIndex(ObjectIntProcedure<? super E> procedure)
- Specified by:
reverseForEachWithIndexin interfaceReversibleIterable<E>
-
forEachWith
public <P> void forEachWith(Procedure2<? super E,? super P> procedure2, P parameter)
- Specified by:
forEachWithin interfaceInternalIterable<E>- Overrides:
forEachWithin classAbstractMutableList<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceList<E>- Specified by:
isEmptyin interfaceRichIterable<E>- Overrides:
isEmptyin classAbstractRichIterable<E>
-
contains
public boolean contains(Object object)
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceList<E>- Specified by:
containsin interfaceRichIterable<E>- Overrides:
containsin classAbstractMutableList<E>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceList<E>- Specified by:
toArrayin interfaceRichIterable<E>- Overrides:
toArrayin classAbstractRichIterable<E>
-
add
public boolean add(E object)
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceList<E>- Overrides:
addin classAbstractMutableCollection<E>
-
remove
public boolean remove(Object object)
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceList<E>- Overrides:
removein classAbstractMutableCollection<E>
-
addAll
public boolean addAll(Collection<? extends E> collection)
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceList<E>- Overrides:
addAllin classAbstractMutableCollection<E>
-
containsAll
public boolean containsAll(Collection<?> collection)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceList<E>- Specified by:
containsAllin interfaceRichIterable<E>- Overrides:
containsAllin classAbstractMutableList<E>
-
toArray
public Object[] toArray(Object[] array)
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceList<E>- Specified by:
toArrayin interfaceRichIterable<E>- Overrides:
toArrayin classAbstractRichIterable<E>
-
addComposited
public void addComposited(Collection<? extends E> collection)
-
addAll
public boolean addAll(int index, Collection<? extends E> collection)
-
clear
public void clear()
-
retainAll
public boolean retainAll(Collection<?> collection)
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceList<E>- Overrides:
retainAllin classAbstractMutableList<E>
-
removeAll
public boolean removeAll(Collection<?> collection)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceList<E>- Overrides:
removeAllin classAbstractMutableList<E>
-
get
public E get(int index)
-
indexOf
public int indexOf(Object o)
- Specified by:
indexOfin interfaceList<E>- Specified by:
indexOfin interfaceMutableList<E>- Specified by:
indexOfin interfaceOrderedIterable<E>- Overrides:
indexOfin classAbstractMutableList<E>
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<E>- Specified by:
lastIndexOfin interfaceListIterable<E>- Overrides:
lastIndexOfin classAbstractMutableList<E>
-
replaceAll
public void replaceAll(UnaryOperator<E> operator)
- Specified by:
replaceAllin interfaceList<E>- Since:
- 10.0
-
sort
public void sort(Comparator<? super E> comparator)
-
listIterator
public ListIterator<E> listIterator()
a list iterator is a problem for a composite list as going back in the order of the list is an issue, as are the other methods like set() and add() (and especially, remove). Convert the internal lists to one list (if not already just one list) and return that list's list iterator.AFAIK list iterator is only commonly used in sorting.
- Specified by:
listIteratorin interfaceList<E>- Specified by:
listIteratorin interfaceListIterable<E>- Overrides:
listIteratorin classAbstractMutableList<E>- Returns:
- a ListIterator for this, with internal state converted to one list if needed.
-
listIterator
public ListIterator<E> listIterator(int index)
a list iterator is a problem for a composite list as going back in the order of the list is an issue, as are the other methods like set() and add() (and especially, remove). Convert the internal lists to one list (if not already just one list) and return that list's list iterator.AFAIK list iterator is only commonly used in sorting.
- Specified by:
listIteratorin interfaceList<E>- Specified by:
listIteratorin interfaceListIterable<E>- Overrides:
listIteratorin classAbstractMutableList<E>- Returns:
- a ListIterator for this, with internal state converted to one list if needed.
-
count
public int count(Predicate<? super E> predicate)
- Specified by:
countin interfaceRichIterable<E>- Overrides:
countin classAbstractMutableList<E>
-
countWith
public <P> int countWith(Predicate2<? super E,? super P> predicate, P parameter)
- Specified by:
countWithin interfaceRichIterable<E>- Overrides:
countWithin classAbstractMutableList<E>
-
anySatisfy
public boolean anySatisfy(Predicate<? super E> predicate)
- Specified by:
anySatisfyin interfaceRichIterable<E>- Overrides:
anySatisfyin classAbstractMutableList<E>
-
select
public <R extends Collection<E>> R select(Predicate<? super E> predicate, R target)
- Specified by:
selectin interfaceRichIterable<E>- Overrides:
selectin classAbstractMutableList<E>
-
selectWith
public <P,R extends Collection<E>> R selectWith(Predicate2<? super E,? super P> predicate, P parameter, R target)
- Specified by:
selectWithin interfaceRichIterable<E>- Overrides:
selectWithin classAbstractMutableList<E>
-
reject
public <R extends Collection<E>> R reject(Predicate<? super E> predicate, R target)
- Specified by:
rejectin interfaceRichIterable<E>- Overrides:
rejectin classAbstractMutableList<E>
-
rejectWith
public <P,R extends Collection<E>> R rejectWith(Predicate2<? super E,? super P> predicate, P parameter, R target)
- Specified by:
rejectWithin interfaceRichIterable<E>- Overrides:
rejectWithin classAbstractMutableList<E>
-
collect
public <V,R extends Collection<V>> R collect(Function<? super E,? extends V> function, R target)
- Specified by:
collectin interfaceRichIterable<E>- Overrides:
collectin classAbstractMutableList<E>
-
collectWith
public <P,A,R extends Collection<A>> R collectWith(Function2<? super E,? super P,? extends A> function, P parameter, R target)
- Specified by:
collectWithin interfaceRichIterable<E>- Overrides:
collectWithin classAbstractMutableList<E>
-
anySatisfyWith
public <P> boolean anySatisfyWith(Predicate2<? super E,? super P> predicate, P parameter)
- Specified by:
anySatisfyWithin interfaceRichIterable<E>- Overrides:
anySatisfyWithin classAbstractMutableList<E>
-
allSatisfy
public boolean allSatisfy(Predicate<? super E> predicate)
- Specified by:
allSatisfyin interfaceRichIterable<E>- Overrides:
allSatisfyin classAbstractMutableList<E>
-
allSatisfyWith
public <P> boolean allSatisfyWith(Predicate2<? super E,? super P> predicate, P parameter)
- Specified by:
allSatisfyWithin interfaceRichIterable<E>- Overrides:
allSatisfyWithin classAbstractMutableList<E>
-
noneSatisfy
public boolean noneSatisfy(Predicate<? super E> predicate)
- Specified by:
noneSatisfyin interfaceRichIterable<E>- Overrides:
noneSatisfyin classAbstractMutableList<E>
-
noneSatisfyWith
public <P> boolean noneSatisfyWith(Predicate2<? super E,? super P> predicate, P parameter)
- Specified by:
noneSatisfyWithin interfaceRichIterable<E>- Overrides:
noneSatisfyWithin classAbstractMutableList<E>
-
asParallel
public ParallelListIterable<E> asParallel(ExecutorService executorService, int batchSize)
- Specified by:
asParallelin interfaceListIterable<E>- Overrides:
asParallelin classAbstractMutableList<E>
-
-