public final class MultiReaderHashBag<T> extends AbstractMultiReaderMutableCollection<T> implements Externalizable, MultiReaderBag<T>
iterator() as this method requires an external lock
to be taken to provide thread-safe iteration. All of these methods are available however, if you use the
withReadLockAndDelegate() or withWriteLockAndDelegate() methods. Both of these methods take a parameter of type
Procedure<MutableBag>, and a wrapped version of the underlying HashBag is returned. This wrapper guarantees that
no external pointer can ever reference the underlying HashBag outside a locked procedure. In the case of the
read lock method, an Unmodifiable version of the collection is offered, which will throw UnsupportedOperationExceptions
on any write methods like add or remove.AbstractMultiReaderMutableCollection.LockWrapper, AbstractMultiReaderMutableCollection.ReadWriteLockWrapper| Constructor and Description |
|---|
MultiReaderHashBag()
Deprecated.
Empty default constructor used for serialization.
|
add, addAll, addAllIterable, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, clear, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, forEachWith, forEachWithIndex, getFirst, getLast, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, into, isEmpty, iterator, makeString, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, parallelStream, reject, rejectWith, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, select, selectAndRejectWith, selectWith, size, spliterator, stream, sumByDouble, sumByFloat, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toImmutableBag, toImmutableList, toImmutableSet, toImmutableSortedBag, toImmutableSortedBag, toImmutableSortedBagBy, toImmutableSortedList, toImmutableSortedList, toImmutableSortedListBy, toImmutableSortedSet, toImmutableSortedSet, toImmutableSortedSetBy, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndexcountBy, countByEach, countByWith, flatCollectWith, selectDuplicates, toImmutableBag, with, withAll, without, withoutAllaggregateBy, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLongaddAllIterable, aggregateBy, aggregateInPlaceBy, injectIntoWith, removeAllIterable, removeIf, removeIfWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloatadd, addAll, clear, contains, containsAll, isEmpty, iterator, parallelStream, remove, removeAll, removeIf, retainAll, size, spliterator, stream, toArray, toArrayallSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, 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, forEachWithIndex@Deprecated public MultiReaderHashBag()
public static <T> MultiReaderHashBag<T> newBag()
public static <T> MultiReaderHashBag<T> newBag(int capacity)
public static <T> MultiReaderHashBag<T> newBag(Iterable<T> iterable)
public static <T> MultiReaderHashBag<T> newBagWith(T... elements)
public void withReadLockAndDelegate(Procedure<? super MutableBag<T>> procedure)
withReadLockAndDelegate in interface MultiReaderBag<T>public void withWriteLockAndDelegate(Procedure<? super MutableBag<T>> procedure)
withWriteLockAndDelegate in interface MultiReaderBag<T>public MutableBag<T> asSynchronized()
asSynchronized in interface MutableBag<T>asSynchronized in interface MutableCollection<T>public MutableBag<T> asUnmodifiable()
asUnmodifiable in interface MutableBag<T>asUnmodifiable in interface MutableCollection<T>public ImmutableBag<T> toImmutable()
toImmutable in interface Bag<T>toImmutable in interface MutableBag<T>toImmutable in interface MutableCollection<T>public int addOccurrences(T item, int occurrences)
addOccurrences in interface MutableBagIterable<T>public boolean removeOccurrences(Object item, int occurrences)
removeOccurrences in interface MutableBagIterable<T>public boolean setOccurrences(T item, int occurrences)
setOccurrences in interface MutableBagIterable<T>public int occurrencesOf(Object item)
occurrencesOf in interface Bag<T>public int sizeDistinct()
sizeDistinct in interface Bag<T>public <V> MutableBag<V> collect(Function<? super T,? extends V> function)
collect in interface MutableBag<T>collect in interface UnsortedBag<T>collect in interface MutableCollection<T>collect in interface RichIterable<T>public MutableBooleanBag collectBoolean(BooleanFunction<? super T> booleanFunction)
collectBoolean in interface MutableBag<T>collectBoolean in interface UnsortedBag<T>collectBoolean in interface MutableCollection<T>collectBoolean in interface RichIterable<T>public MutableByteBag collectByte(ByteFunction<? super T> byteFunction)
collectByte in interface MutableBag<T>collectByte in interface UnsortedBag<T>collectByte in interface MutableCollection<T>collectByte in interface RichIterable<T>public MutableCharBag collectChar(CharFunction<? super T> charFunction)
collectChar in interface MutableBag<T>collectChar in interface UnsortedBag<T>collectChar in interface MutableCollection<T>collectChar in interface RichIterable<T>public MutableDoubleBag collectDouble(DoubleFunction<? super T> doubleFunction)
collectDouble in interface MutableBag<T>collectDouble in interface UnsortedBag<T>collectDouble in interface MutableCollection<T>collectDouble in interface RichIterable<T>public MutableFloatBag collectFloat(FloatFunction<? super T> floatFunction)
collectFloat in interface MutableBag<T>collectFloat in interface UnsortedBag<T>collectFloat in interface MutableCollection<T>collectFloat in interface RichIterable<T>public MutableIntBag collectInt(IntFunction<? super T> intFunction)
collectInt in interface MutableBag<T>collectInt in interface UnsortedBag<T>collectInt in interface MutableCollection<T>collectInt in interface RichIterable<T>public MutableLongBag collectLong(LongFunction<? super T> longFunction)
collectLong in interface MutableBag<T>collectLong in interface UnsortedBag<T>collectLong in interface MutableCollection<T>collectLong in interface RichIterable<T>public MutableShortBag collectShort(ShortFunction<? super T> shortFunction)
collectShort in interface MutableBag<T>collectShort in interface UnsortedBag<T>collectShort in interface MutableCollection<T>collectShort in interface RichIterable<T>public <V> MutableBag<V> flatCollect(Function<? super T,? extends Iterable<V>> function)
flatCollect in interface MutableBag<T>flatCollect in interface UnsortedBag<T>flatCollect in interface MutableCollection<T>flatCollect in interface RichIterable<T>public MutableList<ObjectIntPair<T>> topOccurrences(int count)
topOccurrences in interface Bag<T>topOccurrences in interface MutableBagIterable<T>public MutableList<ObjectIntPair<T>> bottomOccurrences(int count)
bottomOccurrences in interface Bag<T>bottomOccurrences in interface MutableBagIterable<T>public <V> MutableBag<V> collectIf(Predicate<? super T> predicate, Function<? super T,? extends V> function)
collectIf in interface MutableBag<T>collectIf in interface UnsortedBag<T>collectIf in interface MutableCollection<T>collectIf in interface RichIterable<T>public <V> MutableBag<V> collectWithOccurrences(ObjectIntToObjectFunction<? super T,? extends V> function)
collectWithOccurrences in interface Bag<T>collectWithOccurrences in interface MutableBag<T>collectWithOccurrences in interface MutableBagIterable<T>collectWithOccurrences in interface UnsortedBag<T>public <V,R extends Collection<V>> R collectWithOccurrences(ObjectIntToObjectFunction<? super T,? extends V> function, R target)
collectWithOccurrences in interface Bag<T>public <P,V> MutableBag<V> collectWith(Function2<? super T,? super P,? extends V> function, P parameter)
collectWith in interface MutableBag<T>collectWith in interface UnsortedBag<T>collectWith in interface MutableCollection<T>collectWith in interface RichIterable<T>public MutableBag<T> newEmpty()
newEmpty in interface MutableBag<T>newEmpty in interface MutableCollection<T>public MutableBag<T> reject(Predicate<? super T> predicate)
reject in interface Bag<T>reject in interface MutableBag<T>reject in interface MutableBagIterable<T>reject in interface UnsortedBag<T>reject in interface MutableCollection<T>reject in interface RichIterable<T>public <P> MutableBag<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
rejectWith in interface Bag<T>rejectWith in interface MutableBag<T>rejectWith in interface MutableBagIterable<T>rejectWith in interface UnsortedBag<T>rejectWith in interface MutableCollection<T>rejectWith in interface RichIterable<T>public MutableBag<T> tap(Procedure<? super T> procedure)
tap in interface Bag<T>tap in interface MutableBag<T>tap in interface MutableBagIterable<T>tap in interface UnsortedBag<T>tap in interface MutableCollection<T>tap in interface RichIterable<T>public MutableBag<T> select(Predicate<? super T> predicate)
select in interface Bag<T>select in interface MutableBag<T>select in interface MutableBagIterable<T>select in interface UnsortedBag<T>select in interface MutableCollection<T>select in interface RichIterable<T>public <P> MutableBag<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
selectWith in interface Bag<T>selectWith in interface MutableBag<T>selectWith in interface MutableBagIterable<T>selectWith in interface UnsortedBag<T>selectWith in interface MutableCollection<T>selectWith in interface RichIterable<T>public MutableBag<T> selectByOccurrences(IntPredicate predicate)
selectByOccurrences in interface Bag<T>selectByOccurrences in interface MutableBag<T>selectByOccurrences in interface MutableBagIterable<T>selectByOccurrences in interface UnsortedBag<T>public <S> MutableBag<S> selectInstancesOf(Class<S> clazz)
selectInstancesOf in interface Bag<T>selectInstancesOf in interface MutableBag<T>selectInstancesOf in interface MutableBagIterable<T>selectInstancesOf in interface UnsortedBag<T>selectInstancesOf in interface MutableCollection<T>selectInstancesOf in interface RichIterable<T>public PartitionMutableBag<T> partition(Predicate<? super T> predicate)
partition in interface Bag<T>partition in interface MutableBag<T>partition in interface MutableBagIterable<T>partition in interface UnsortedBag<T>partition in interface MutableCollection<T>partition in interface RichIterable<T>public <P> PartitionMutableBag<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
partitionWith in interface Bag<T>partitionWith in interface MutableBag<T>partitionWith in interface MutableBagIterable<T>partitionWith in interface MutableCollection<T>partitionWith in interface RichIterable<T>public MutableMap<T,Integer> toMapOfItemToCount()
toMapOfItemToCount in interface Bag<T>toMapOfItemToCount in interface MutableBag<T>toMapOfItemToCount in interface MutableBagIterable<T>public String toStringOfItemToCount()
toStringOfItemToCount in interface Bag<T>public <V> MutableBagMultimap<V,T> groupBy(Function<? super T,? extends V> function)
groupBy in interface Bag<T>groupBy in interface MutableBag<T>groupBy in interface MutableBagIterable<T>groupBy in interface UnsortedBag<T>groupBy in interface MutableCollection<T>groupBy in interface RichIterable<T>public <V> MutableBagMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)
groupByEach in interface Bag<T>groupByEach in interface MutableBag<T>groupByEach in interface MutableBagIterable<T>groupByEach in interface UnsortedBag<T>groupByEach in interface MutableCollection<T>groupByEach in interface RichIterable<T>public <V> MutableMap<V,T> groupByUniqueKey(Function<? super T,? extends V> function)
groupByUniqueKey in interface MutableCollection<T>groupByUniqueKey in interface RichIterable<T>@Deprecated public <S> MutableBag<Pair<T,S>> zip(Iterable<S> that)
OrderedIterable.zip(Iterable) instead.zip in interface MutableBag<T>zip in interface UnsortedBag<T>zip in interface MutableCollection<T>zip in interface RichIterable<T>@Deprecated public MutableSet<Pair<T,Integer>> zipWithIndex()
OrderedIterable.zipWithIndex() instead.zipWithIndex in interface Bag<T>zipWithIndex in interface MutableBag<T>zipWithIndex in interface MutableBagIterable<T>zipWithIndex in interface UnsortedBag<T>zipWithIndex in interface MutableCollection<T>zipWithIndex in interface RichIterable<T>public RichIterable<RichIterable<T>> chunk(int size)
chunk in interface RichIterable<T>public boolean anySatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)
anySatisfyWithOccurrences in interface Bag<T>public boolean allSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)
allSatisfyWithOccurrences in interface Bag<T>public boolean noneSatisfyWithOccurrences(ObjectIntPredicate<? super T> predicate)
noneSatisfyWithOccurrences in interface Bag<T>public T detectWithOccurrences(ObjectIntPredicate<? super T> predicate)
detectWithOccurrences in interface Bag<T>public <V> MutableObjectLongMap<V> sumByInt(Function<? super T,? extends V> groupBy, IntFunction<? super T> function)
sumByInt in interface MutableCollection<T>sumByInt in interface RichIterable<T>sumByInt in class AbstractMultiReaderMutableCollection<T>public <V> MutableObjectLongMap<V> sumByLong(Function<? super T,? extends V> groupBy, LongFunction<? super T> function)
sumByLong in interface MutableCollection<T>sumByLong in interface RichIterable<T>sumByLong in class AbstractMultiReaderMutableCollection<T>public void forEachWithOccurrences(ObjectIntProcedure<? super T> procedure)
forEachWithOccurrences in interface Bag<T>public boolean equals(Object o)
public int hashCode()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic MutableSet<T> selectUnique()
selectUnique in interface Bag<T>selectUnique in interface MutableBag<T>selectUnique in interface MutableBagIterable<T>selectUnique in interface UnsortedBag<T>public RichIterable<T> distinctView()
distinctView in interface Bag<T>Copyright © 2004–2022. All rights reserved.