public interface FixedSizeCollection<T> extends MutableCollection<T>
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(T t) |
boolean |
addAll(Collection<? extends T> collection) |
boolean |
addAllIterable(Iterable<? extends T> iterable) |
void |
clear() |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> collection) |
boolean |
removeAllIterable(Iterable<?> iterable) |
boolean |
removeIf(Predicate<? super T> predicate)
Removes all elements in the collection that evaluate to true for the specified predicate.
|
<P> boolean |
removeIfWith(Predicate2<? super T,? super P> predicate,
P parameter)
Removes all elements in the collection that evaluate to true for the specified predicate2 and parameter.
|
boolean |
retainAll(Collection<?> collection) |
boolean |
retainAllIterable(Iterable<?> iterable) |
FixedSizeCollection<T> |
tap(Procedure<? super T> procedure)
Executes the Procedure for each element in the iterable and returns
this. |
MutableCollection<T> |
with(T element)
This method allows fixed size collections the ability to add elements to their existing elements.
|
MutableCollection<T> |
withAll(Iterable<? extends T> elements)
This method allows fixed size collections the ability to add multiple elements to their existing elements.
|
MutableCollection<T> |
without(T element)
This method allows fixed size collections the ability to remove elements from their existing elements.
|
MutableCollection<T> |
withoutAll(Iterable<? extends T> elements)
This method allows fixed size collections the ability to remove multiple elements from their existing elements.
|
aggregateBy, aggregateInPlaceBy, asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, countBy, countByEach, countByWith, flatCollect, flatCollectWith, groupBy, groupByEach, groupByUniqueKey, injectIntoWith, newEmpty, partition, partitionWith, reject, rejectWith, select, selectAndRejectWith, selectInstancesOf, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, toImmutable, zip, zipWithIndexcontains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, removeIf, size, spliterator, stream, toArray, toArrayaggregateBy, 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, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoDouble, injectIntoFloat, injectIntoInt, injectIntoLong, into, isEmpty, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, 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, toImmutableList, 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, zip, zipWithIndexforEach, forEachWith, forEachWithIndexMutableCollection<T> with(T element)
MutableCollection is returned containing the elements of the original collection with the new element
added. Implementations will return a new FixedSizeCollection where possible. In order to
use this method properly with mutable and fixed size collections the following approach must be taken:
MutableCollection<String> list;
list = list.with("1");
list = list.with("2");
return list;
with in interface MutableCollection<T>add(Object)MutableCollection<T> without(T element)
MutableCollection is returned containing the elements of the original collection with the
element removed. Implementations will return a new FixedSizeCollection where possible.
In order to use this method properly with mutable and fixed size collections the following approach must be
taken:
MutableCollection<String> list;
list = list.without("1");
list = list.without("2");
return list;
without in interface MutableCollection<T>remove(Object)MutableCollection<T> withAll(Iterable<? extends T> elements)
MutableCollection is returned containing the elements of the original collection with all
the new elements addAll(Collection) added. Implementations will return a new FixedSizeCollection where
possible. In order to use this method properly with mutable and fixed size collections the following approach
must be taken:
MutableCollection<String> list;
list = list.withAll(FastList.newListWith("1", "2"));
return list;
withAll in interface MutableCollection<T>addAll(Collection)MutableCollection<T> withoutAll(Iterable<? extends T> elements)
MutableCollection is returned containing the elements of the original collection with
the given elements removed. Implementations will return a new FixedSizeCollection
where possible. In order to use this method properly with mutable and fixed size collections the following
approach must be taken:
MutableCollection<String> list;
list = list.withoutAll(FastList.newListWith("1", "2"));
return list;
withoutAll in interface MutableCollection<T>removeAll(Collection)boolean add(T t)
add in interface Collection<T>UnsupportedOperationException - the add operation is not supported by this collection.boolean addAllIterable(Iterable<? extends T> iterable)
addAllIterable in interface MutableCollection<T>UnsupportedOperationException - the addAllIterable operation is not supported by this collection.Collection.addAll(Collection)boolean addAll(Collection<? extends T> collection)
addAll in interface Collection<T>UnsupportedOperationException - the addAll operation is not supported by this collection.boolean remove(Object o)
remove in interface Collection<T>UnsupportedOperationException - the remove operation is not supported by this collection.boolean removeAll(Collection<?> collection)
removeAll in interface Collection<T>UnsupportedOperationException - the removeAll method is not supported by this collection.boolean removeAllIterable(Iterable<?> iterable)
removeAllIterable in interface MutableCollection<T>UnsupportedOperationException - the removeAllIterable method is not supported by this collection.Collection.removeAll(Collection)boolean removeIf(Predicate<? super T> predicate)
MutableCollectione.g. return lastNames.removeIf(Predicates.isNull());
removeIf in interface MutableCollection<T>UnsupportedOperationException - the removeIf method is not supported by this collection.<P> boolean removeIfWith(Predicate2<? super T,? super P> predicate, P parameter)
MutableCollectionreturn lastNames.removeIfWith(Predicates2.isNull(), null);
removeIfWith in interface MutableCollection<T>UnsupportedOperationException - the removeIfWith method is not supported by this collection.boolean retainAll(Collection<?> collection)
retainAll in interface Collection<T>UnsupportedOperationException - the retainAll method is not supported by this collection.boolean retainAllIterable(Iterable<?> iterable)
retainAllIterable in interface MutableCollection<T>UnsupportedOperationException - the retainAllIterable method is not supported by this collection.Collection.retainAll(Collection)void clear()
clear in interface Collection<T>UnsupportedOperationException - the clear method is not supported by this collection.FixedSizeCollection<T> tap(Procedure<? super T> procedure)
RichIterablethis.
Example using a Java 8 lambda expression:
RichIterable<Person> tapped =
people.tap(person -> LOGGER.info(person.getName()));
tap in interface MutableCollection<T>tap in interface RichIterable<T>RichIterable.each(Procedure),
RichIterable.forEach(Procedure)Copyright © 2004–2023. All rights reserved.