public interface MultiReaderBag<T> extends MutableBag<T>
withReadLockAndDelegate() and withWriteLockAndDelegate().| Modifier and Type | Method and Description |
|---|---|
MultiReaderBag<T> |
newEmpty()
Creates a new empty mutable version of the same collection type.
|
default MultiReaderBag<T> |
tap(Procedure<? super T> procedure)
Executes the Procedure for each element in the iterable and returns
this. |
default MultiReaderBag<T> |
with(T element)
This method allows mutable and fixed size collections the ability to add elements to their existing elements.
|
default MultiReaderBag<T> |
withAll(Iterable<? extends T> elements)
This method allows mutable and fixed size collections the ability to add multiple elements to their existing
elements.
|
default MultiReaderBag<T> |
without(T element)
This method allows mutable and fixed size collections the ability to remove elements from their existing elements.
|
default MultiReaderBag<T> |
withoutAll(Iterable<? extends T> elements)
This method allows mutable and fixed size collections the ability to remove multiple elements from their existing
elements.
|
void |
withReadLockAndDelegate(Procedure<? super MutableBag<T>> procedure) |
void |
withWriteLockAndDelegate(Procedure<? super MutableBag<T>> procedure) |
asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, collectWithOccurrences, countBy, countByEach, countByWith, flatCollect, flatCollectWith, groupBy, groupByEach, partition, partitionWith, reject, rejectWith, select, selectByOccurrences, selectDuplicates, selectInstancesOf, selectUnique, selectWith, toImmutable, toImmutableBag, toMapOfItemToCount, zip, zipWithIndexaddOccurrences, bottomOccurrences, removeOccurrences, setOccurrences, topOccurrencesaggregateBy, allSatisfyWithOccurrences, anySatisfyWithOccurrences, collectWithOccurrences, detectWithOccurrences, distinctView, equals, forEachWithOccurrences, hashCode, noneSatisfyWithOccurrences, occurrencesOf, reduceInPlace, reduceInPlace, sizeDistinct, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, toStringOfItemToCountaddAllIterable, aggregateBy, aggregateInPlaceBy, groupByUniqueKey, injectIntoWith, removeAllIterable, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLongadd, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayallSatisfy, 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, reject, rejectWith, select, selectWith, size, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, 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, forEachWithIndexvoid withReadLockAndDelegate(Procedure<? super MutableBag<T>> procedure)
void withWriteLockAndDelegate(Procedure<? super MutableBag<T>> procedure)
MultiReaderBag<T> newEmpty()
MutableCollectionnewEmpty in interface MutableBag<T>newEmpty in interface MutableCollection<T>default MultiReaderBag<T> with(T element)
MutableCollection
MutableCollection<String> list = list.with("1");
list = list.with("2");
return list;
In the case of FixedSizeCollection a 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.with in interface MutableBag<T>with in interface MutableBagIterable<T>with in interface MutableCollection<T>Collection.add(Object)default MultiReaderBag<T> without(T element)
MutableCollection
MutableCollection<String> list = list.without("1");
list = list.without("2");
return list;
In the case of FixedSizeCollection a 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.without in interface MutableBag<T>without in interface MutableBagIterable<T>without in interface MutableCollection<T>Collection.remove(Object)default MultiReaderBag<T> withAll(Iterable<? extends T> elements)
MutableCollection
MutableCollection<String> list = list.withAll(FastList.newListWith("1", "2"));
In the case of FixedSizeCollection a 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.withAll in interface MutableBag<T>withAll in interface MutableBagIterable<T>withAll in interface MutableCollection<T>Collection.addAll(Collection)default MultiReaderBag<T> withoutAll(Iterable<? extends T> elements)
MutableCollection
MutableCollection<String> list = list.withoutAll(FastList.newListWith("1", "2"));
In the case of FixedSizeCollection a 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.withoutAll in interface MutableBag<T>withoutAll in interface MutableBagIterable<T>withoutAll in interface MutableCollection<T>Collection.removeAll(Collection)default MultiReaderBag<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 Bag<T>tap in interface MutableBag<T>tap in interface MutableBagIterable<T>tap in interface MutableCollection<T>tap in interface RichIterable<T>tap in interface UnsortedBag<T>RichIterable.each(Procedure),
RichIterable.forEach(Procedure)Copyright © 2004–2023. All rights reserved.