Class HashBagWithHashingStrategy<T>
java.lang.Object
org.eclipse.collections.impl.AbstractRichIterable<T>
org.eclipse.collections.impl.bag.AbstractBag<T>
org.eclipse.collections.impl.bag.mutable.AbstractMutableBagIterable<T>
org.eclipse.collections.impl.bag.mutable.AbstractMutableBag<T>
org.eclipse.collections.impl.bag.mutable.AbstractHashBag<T>
org.eclipse.collections.impl.bag.strategy.mutable.HashBagWithHashingStrategy<T>
- All Implemented Interfaces:
Serializable,Iterable<T>,Collection<T>,Bag<T>,MutableBag<T>,MutableBagIterable<T>,UnsortedBag<T>,MutableCollection<T>,InternalIterable<T>,RichIterable<T>
public class HashBagWithHashingStrategy<T> extends AbstractHashBag<T> implements Serializable
- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int size) -
Method Summary
Modifier and Type Method Description HashingStrategy<? super T>hashingStrategy()static <E> HashBagWithHashingStrategy<E>newBag(HashingStrategy<? super E> hashingStrategy)static <E> HashBagWithHashingStrategy<E>newBag(HashingStrategy<? super E> hashingStrategy, int size)static <E> HashBagWithHashingStrategy<E>newBag(HashingStrategy<? super E> hashingStrategy, Iterable<? extends E> source)static <E> HashBagWithHashingStrategy<E>newBag(HashingStrategy<? super E> hashingStrategy, Bag<? extends E> source)static <E> HashBagWithHashingStrategy<E>newBagWith(HashingStrategy<? super E> hashingStrategy, E... elements)MutableBag<T>newEmpty()Creates a new empty mutable version of the same collection type.MutableBag<T>selectByOccurrences(IntPredicate predicate)Returns all elements of the bag that have a number of occurrences that satisfy the predicate.MutableBag<T>with(T element)This method allows mutable and fixed size collections the ability to add elements to their existing elements.MutableBag<T>withAll(Iterable<? extends T> elements)This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.MutableBag<T>without(T element)This method allows mutable and fixed size collections the ability to remove elements from their existing elements.MutableBag<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 class org.eclipse.collections.impl.bag.mutable.AbstractHashBag
add, addOccurrences, clear, contains, each, equals, forEachWith, forEachWithIndex, forEachWithOccurrences, groupBy, groupByEach, hashCode, isEmpty, iterator, occurrencesOf, remove, removeAllIterable, removeIf, removeIfWith, removeOccurrences, setOccurrences, size, sizeDistinct, toMapOfItemToCountMethods inherited from class org.eclipse.collections.impl.bag.mutable.AbstractMutableBag
asParallel, asSynchronized, asUnmodifiable, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, collectWithOccurrences, countBy, countByEach, countByWith, flatCollect, partition, partitionWith, reject, rejectWith, select, selectInstancesOf, selectWith, tap, toImmutable, zip, zipWithIndexMethods inherited from class org.eclipse.collections.impl.bag.mutable.AbstractMutableBagIterable
addAll, addAllIterable, aggregateInPlaceBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, bottomOccurrences, chunk, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, getFirst, getLast, groupByUniqueKey, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, removeAll, retainAll, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, topOccurrencesMethods inherited from class org.eclipse.collections.impl.bag.AbstractBag
collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, count, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, groupBy, groupByEach, injectInto, injectInto, injectInto, injectInto, injectInto, injectIntoWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toList, toSet, toSortedBag, toSortedBag, toSortedList, toSortedSet, toSortedSet, toStringOfItemToCountMethods inherited from class org.eclipse.collections.impl.AbstractRichIterable
appendString, appendString, asLazy, containsAll, containsAllArguments, containsAllIterable, countWith, forEach, groupByUniqueKey, into, toArray, toArray, toBiMap, toMap, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSetBy, toString, zip, zipWithIndexMethods inherited from interface org.eclipse.collections.api.bag.Bag
aggregateBy, collectWithOccurrences, reduceInPlace, reduceInPlace, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, toStringOfItemToCountMethods inherited from interface java.util.Collection
addAll, containsAll, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArrayMethods inherited from interface org.eclipse.collections.api.bag.MutableBag
flatCollectWith, selectDuplicates, selectUniqueMethods inherited from interface org.eclipse.collections.api.bag.MutableBagIterable
bottomOccurrences, selectDuplicates, selectUnique, topOccurrencesMethods inherited from interface org.eclipse.collections.api.collection.MutableCollection
addAllIterable, aggregateBy, aggregateInPlaceBy, flatCollectWith, groupByUniqueKey, injectIntoWith, retainAllIterable, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLongMethods inherited from interface org.eclipse.collections.api.RichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, containsBy, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getFirst, getLast, getOnly, groupBy, groupByAndCollect, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, makeString, makeString, makeString, max, max, maxBy, maxByOptional, maxOptional, maxOptional, min, min, minBy, minByOptional, minOptional, minOptional, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, toBag, toBiMap, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Constructor Details
-
Method Details
-
newBag
-
newBag
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy, int size) -
newBag
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy, Bag<? extends E> source) -
newBag
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy, Iterable<? extends E> source) -
newBagWith
public static <E> HashBagWithHashingStrategy<E> newBagWith(HashingStrategy<? super E> hashingStrategy, E... elements) -
hashingStrategy
-
selectByOccurrences
Description copied from interface:BagReturns all elements of the bag that have a number of occurrences that satisfy the predicate.- Specified by:
selectByOccurrencesin interfaceBag<T>- Specified by:
selectByOccurrencesin interfaceMutableBag<T>- Specified by:
selectByOccurrencesin interfaceMutableBagIterable<T>- Specified by:
selectByOccurrencesin interfaceUnsortedBag<T>
-
with
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 interfaceMutableBag<T>- Specified by:
within interfaceMutableBagIterable<T>- Specified by:
within interfaceMutableCollection<T>- See Also:
Collection.add(Object)
-
without
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 interfaceMutableBag<T>- Specified by:
withoutin interfaceMutableBagIterable<T>- Specified by:
withoutin interfaceMutableCollection<T>- See Also:
Collection.remove(Object)
-
withAll
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 interfaceMutableBag<T>- Specified by:
withAllin interfaceMutableBagIterable<T>- Specified by:
withAllin interfaceMutableCollection<T>- See Also:
Collection.addAll(Collection)
-
withoutAll
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 interfaceMutableBag<T>- Specified by:
withoutAllin interfaceMutableBagIterable<T>- Specified by:
withoutAllin interfaceMutableCollection<T>- See Also:
Collection.removeAll(Collection)
-
newEmpty
Description copied from interface:MutableCollectionCreates a new empty mutable version of the same collection type. For example, if this instance is a FastList, this method will return a new empty FastList. If the class of this instance is immutable or fixed size (i.e. SingletonList) then a mutable alternative to the class will be provided.- Specified by:
newEmptyin interfaceMutableBag<T>- Specified by:
newEmptyin interfaceMutableCollection<T>
-