Top Fields Constructors Methods
org.eclipse.collections.impl.bag.strategy.mutable

public Class HashBagWithHashingStrategy<T>

extends AbstractHashBag<T>
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Imports
java.io.Serializable, org.eclipse.collections.api.bag.Bag, .MutableBag, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.predicate.primitive.IntPredicate, org.eclipse.collections.api.map.primitive.MutableObjectIntMap, org.eclipse.collections.impl.bag.mutable.AbstractHashBag, org.eclipse.collections.impl.map.mutable.primitive.ObjectIntHashMap, .ObjectIntHashMapWithHashingStrategy, org.eclipse.collections.impl.utility.ArrayIterate, .Iterate

Field Summary

Modifier and TypeField and Description
private final HashingStrategy<? super T>
private static final long
Inherited from org.eclipse.collections.impl.bag.mutable.AbstractHashBag:
itemssize

Constructor Summary

AccessConstructor and Description
public
HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)

public
HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int size)

private

Method Summary

Modifier and TypeMethod and Description
protected int
public HashingStrategy<? super T>
public static <E> HashBagWithHashingStrategy<E>
newBag(HashingStrategy<? super E> hashingStrategy)

public static <E> HashBagWithHashingStrategy<E>
newBag(HashingStrategy<? super E> hashingStrategy, int size)

public static <E> HashBagWithHashingStrategy<E>
newBag(HashingStrategy<? super E> hashingStrategy, Bag<? extends E> source)

public static <E> HashBagWithHashingStrategy<E>
newBag(HashingStrategy<? super E> hashingStrategy, Iterable<? extends E> source)

public static <E> HashBagWithHashingStrategy<E>
newBagWith(HashingStrategy<? super E> hashingStrategy, E... elements)

public MutableBag<T>
public MutableBag<T>
public void
trimToSize()

Rehashes every element in the set into a new backing table of the smallest possible size and eliminating removed sentinels.

public MutableBag<T>
with(T element)

Overrides default org.eclipse.collections.api.bag.MutableBag.with, org.eclipse.collections.api.bag.MutableBagIterable.with.

This method allows mutable and fixed size collections the ability to add elements to their existing elements.

public MutableBag<T>
withAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.bag.MutableBag.withAll, org.eclipse.collections.api.bag.MutableBagIterable.withAll.

This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.

public MutableBag<T>
without(T element)

Overrides default org.eclipse.collections.api.bag.MutableBag.without, org.eclipse.collections.api.bag.MutableBagIterable.without.

This method allows mutable and fixed size collections the ability to remove elements from their existing elements.

public MutableBag<T>
withoutAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.bag.MutableBag.withoutAll, org.eclipse.collections.api.bag.MutableBagIterable.withoutAll.

This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements.

protected Object
Inherited from org.eclipse.collections.impl.bag.mutable.AbstractHashBag:
addaddOccurrencesallSatisfyWithOccurrencesanySatisfyWithOccurrencesclearcontainsdetectWithOccurrencesdistinctVieweachequalsforEachWithforEachWithIndexforEachWithOccurrencesgetKeysViewgroupBygroupByEachhashCodeisEmptyiteratornoneSatisfyWithOccurrencesoccurrencesOfremoveremoveAllIterableremoveIfremoveIfWithremoveOccurrencessetOccurrencessizesizeDistincttoMapOfItemToCount

Field Detail

hashingStrategyback to summary
private final HashingStrategy<? super T> hashingStrategy
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

HashBagWithHashingStrategyback to summary
public HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)
HashBagWithHashingStrategyback to summary
public HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int size)
HashBagWithHashingStrategyback to summary
private HashBagWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, MutableObjectIntMap<T> map)

Method Detail

computeHashCodeback to summary
protected int computeHashCode(T item)

Implements abstract org.eclipse.collections.impl.bag.mutable.AbstractHashBag.computeHashCode.

Annotations
@Override
hashingStrategyback to summary
public HashingStrategy<? super T> hashingStrategy()
newBagback to summary
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy)
newBagback to summary
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy, int size)
newBagback to summary
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy, Bag<? extends E> source)
newBagback to summary
public static <E> HashBagWithHashingStrategy<E> newBag(HashingStrategy<? super E> hashingStrategy, Iterable<? extends E> source)
newBagWithback to summary
public static <E> HashBagWithHashingStrategy<E> newBagWith(HashingStrategy<? super E> hashingStrategy, E... elements)
newEmptyback to summary
public MutableBag<T> newEmpty()

Implements org.eclipse.collections.api.bag.MutableBag.newEmpty, org.eclipse.collections.api.collection.MutableCollection.newEmpty.

Doc from org.eclipse.collections.api.collection.MutableCollection.newEmpty.

Creates 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.

Annotations
@Override
selectByOccurrencesback to summary
public MutableBag<T> selectByOccurrences(IntPredicate predicate)

Implements org.eclipse.collections.api.bag.MutableBag.selectByOccurrences, org.eclipse.collections.api.bag.MutableBagIterable.selectByOccurrences, org.eclipse.collections.api.bag.Bag.selectByOccurrences.

Doc from org.eclipse.collections.api.bag.Bag.selectByOccurrences.

Returns all elements of the bag that have a number of occurrences that satisfy the predicate.

Annotations
@Override
trimToSizeback to summary
public void trimToSize()

Rehashes every element in the set into a new backing table of the smallest possible size and eliminating removed sentinels.

Since
12.0
withback to summary
public MutableBag<T> with(T element)

Overrides default org.eclipse.collections.api.bag.MutableBag.with, org.eclipse.collections.api.bag.MutableBagIterable.with.

Doc from org.eclipse.collections.api.collection.MutableCollection.with.

This 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 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.
Annotations
@Override
withAllback to summary
public MutableBag<T> withAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.bag.MutableBag.withAll, org.eclipse.collections.api.bag.MutableBagIterable.withAll.

Doc from org.eclipse.collections.api.collection.MutableCollection.withAll.

This 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 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.
Annotations
@Override
withoutback to summary
public MutableBag<T> without(T element)

Overrides default org.eclipse.collections.api.bag.MutableBag.without, org.eclipse.collections.api.bag.MutableBagIterable.without.

Doc from org.eclipse.collections.api.collection.MutableCollection.without.

This 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 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.
Annotations
@Override
withoutAllback to summary
public MutableBag<T> withoutAll(Iterable<? extends T> elements)

Overrides default org.eclipse.collections.api.bag.MutableBag.withoutAll, org.eclipse.collections.api.bag.MutableBagIterable.withoutAll.

Doc from org.eclipse.collections.api.collection.MutableCollection.withoutAll.

This 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 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.
Annotations
@Override
writeReplaceback to summary
protected Object writeReplace()