Package org.eclipse.collections.api.list
Interface FixedSizeList<T>
-
- All Superinterfaces:
Cloneable,Collection<T>,FixedSizeCollection<T>,InternalIterable<T>,Iterable<T>,List<T>,ListIterable<T>,MutableCollection<T>,MutableList<T>,OrderedIterable<T>,ReversibleIterable<T>,RichIterable<T>
public interface FixedSizeList<T> extends MutableList<T>, FixedSizeCollection<T>
A FixedSizeList is a list that may be mutated, but cannot grow or shrink in size. The typical mutation allowed for a FixedSizeList implementation is a working implementation for set(int, T). This will allow the FixedSizeList to be sorted.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default FixedSizeList<T>sortThis()Sorts the internal data structure of this list and returns the list itself as a convenience.default FixedSizeList<T>sortThis(Comparator<? super T> comparator)Sorts the internal data structure of this list and returns the list itself as a convenience.FixedSizeList<T>tap(Procedure<? super T> procedure)Executes the Procedure for each element in the iterable and returnsthis.FixedSizeList<T>toReversed()Returns a new MutableList in reverse order.MutableList<T>with(T element)This method allows mutable and fixed size collections the ability to add elements to their existing elements.MutableList<T>withAll(Iterable<? extends T> elements)This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.MutableList<T>without(T element)This method allows mutable and fixed size collections the ability to remove elements from their existing elements.MutableList<T>withoutAll(Iterable<? extends T> elements)This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements.-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.eclipse.collections.api.collection.FixedSizeCollection
add, addAll, addAllIterable, clear, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith
-
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArray
-
Methods inherited from interface org.eclipse.collections.api.list.ListIterable
asParallel, binarySearch, binarySearch, equals, forEachInBoth, get, hashCode, lastIndexOf, listIterator, listIterator
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, groupByUniqueKey, injectIntoWith, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.list.MutableList
asSynchronized, asUnmodifiable, clone, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, collectWithIndex, distinct, distinct, distinctBy, drop, dropWhile, flatCollect, flatCollectWith, getFirst, getLast, groupBy, groupByEach, indexOf, newEmpty, partition, partitionWhile, partitionWith, reject, rejectWith, rejectWithIndex, reverseThis, select, selectInstancesOf, selectWith, selectWithIndex, shuffleThis, shuffleThis, sortThisBy, sortThisByBoolean, sortThisByByte, sortThisByChar, sortThisByDouble, sortThisByFloat, sortThisByInt, sortThisByLong, sortThisByShort, subList, take, takeWhile, toImmutable, toImmutableList, zip, zipWithIndex
-
Methods inherited from interface org.eclipse.collections.api.ordered.OrderedIterable
collectWithIndex, corresponds, detectIndex, forEach, forEachWithIndex, forEachWithIndex, getFirstOptional, getLastOptional, max, min, rejectWithIndex, selectWithIndex, toStack, zip, zipWithIndex
-
Methods inherited from interface org.eclipse.collections.api.ordered.ReversibleIterable
asReversed, detectLastIndex, reverseForEach, reverseForEachWithIndex
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, 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, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, maxBy, maxByOptional, maxOptional, maxOptional, 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, 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
-
with
MutableList<T> with(T element)
Description copied from interface:MutableCollectionThis method allows mutable and fixed size collections the ability to add elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new element to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:MutableCollection<String> list = list.with("1"); list = list.with("2"); return list;In the case ofFixedSizeCollectiona 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.- Specified by:
within interfaceFixedSizeCollection<T>- Specified by:
within interfaceMutableCollection<T>- Specified by:
within interfaceMutableList<T>- See Also:
Collection.add(Object)
-
without
MutableList<T> without(T element)
Description copied from interface:MutableCollectionThis method allows mutable and fixed size collections the ability to remove elements from their existing elements. In order to support fixed size a new instance of a collection would have to be returned containing the elements that would be left from the original collection after calling remove. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:MutableCollection<String> list = list.without("1"); list = list.without("2"); return list;In the case ofFixedSizeCollectiona 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.- Specified by:
withoutin interfaceFixedSizeCollection<T>- Specified by:
withoutin interfaceMutableCollection<T>- Specified by:
withoutin interfaceMutableList<T>- See Also:
Collection.remove(Object)
-
withAll
MutableList<T> withAll(Iterable<? extends T> elements)
Description copied from interface:MutableCollectionThis method allows mutable and fixed size collections the ability to add multiple elements to their existing elements. In order to support fixed size a new instance of a collection would have to be returned taking the elements of the original collection and appending the new elements to form the new collection. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:MutableCollection<String> list = list.withAll(FastList.newListWith("1", "2"));In the case ofFixedSizeCollectiona 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.- Specified by:
withAllin interfaceFixedSizeCollection<T>- Specified by:
withAllin interfaceMutableCollection<T>- Specified by:
withAllin interfaceMutableList<T>- See Also:
Collection.addAll(Collection)
-
withoutAll
MutableList<T> withoutAll(Iterable<? extends T> elements)
Description copied from interface:MutableCollectionThis method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements. In order to support fixed size a new instance of a collection would have to be returned containing the elements that would be left from the original collection after calling removeAll. In the case of mutable collections, the original collection is modified, and is returned. In order to use this method properly with mutable and fixed size collections the following approach must be taken:MutableCollection<String> list = list.withoutAll(FastList.newListWith("1", "2"));In the case ofFixedSizeCollectiona 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.- Specified by:
withoutAllin interfaceFixedSizeCollection<T>- Specified by:
withoutAllin interfaceMutableCollection<T>- Specified by:
withoutAllin interfaceMutableList<T>- See Also:
Collection.removeAll(Collection)
-
toReversed
FixedSizeList<T> toReversed()
Description copied from interface:MutableListReturns a new MutableList in reverse order.- Specified by:
toReversedin interfaceListIterable<T>- Specified by:
toReversedin interfaceMutableList<T>- Specified by:
toReversedin interfaceReversibleIterable<T>
-
tap
FixedSizeList<T> tap(Procedure<? super T> procedure)
Description copied from interface:RichIterableExecutes the Procedure for each element in the iterable and returnsthis.Example using a Java 8 lambda expression:
RichIterable<Person> tapped = people.tap(person -> LOGGER.info(person.getName()));- Specified by:
tapin interfaceFixedSizeCollection<T>- Specified by:
tapin interfaceListIterable<T>- Specified by:
tapin interfaceMutableCollection<T>- Specified by:
tapin interfaceMutableList<T>- Specified by:
tapin interfaceOrderedIterable<T>- Specified by:
tapin interfaceReversibleIterable<T>- Specified by:
tapin interfaceRichIterable<T>- See Also:
RichIterable.each(Procedure),RichIterable.forEach(Procedure)
-
sortThis
default FixedSizeList<T> sortThis(Comparator<? super T> comparator)
Description copied from interface:MutableListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableList<T>
-
sortThis
default FixedSizeList<T> sortThis()
Description copied from interface:MutableListSorts the internal data structure of this list and returns the list itself as a convenience.- Specified by:
sortThisin interfaceMutableList<T>
-
-