Top Inners Fields Constructors Methods
org.eclipse.collections.impl.set.strategy.mutable

public Class UnifiedSetWithHashingStrategy<T>

extends AbstractUnifiedSet<T>
implements Externalizable
Class Inheritance
All Implemented Interfaces
java.io.Externalizable, java.io.Serializable
Imports
java.io.Externalizable, .IOException, .ObjectInput, .ObjectOutput, java.lang.reflect.Array, java.util.Arrays, .Collection, .Iterator, .NoSuchElementException, .Optional, .Set, java.util.concurrent.ExecutorService, org.eclipse.collections.api.LazyIterable, .RichIterable, org.eclipse.collections.api.annotation.Beta, org.eclipse.collections.api.block.HashingStrategy, org.eclipse.collections.api.block.function.Function, org.eclipse.collections.api.block.predicate.Predicate, .Predicate2, org.eclipse.collections.api.block.procedure.Procedure, .Procedure2, org.eclipse.collections.api.block.procedure.primitive.ObjectIntProcedure, org.eclipse.collections.api.factory.Lists, org.eclipse.collections.api.list.MutableList, org.eclipse.collections.api.partition.set.PartitionMutableSet, org.eclipse.collections.api.set.ImmutableSet, .ParallelUnsortedSetIterable, org.eclipse.collections.api.tuple.Twin, org.eclipse.collections.impl.block.factory.Procedures2, org.eclipse.collections.impl.block.procedure.PartitionPredicate2Procedure, .PartitionProcedure, .SelectInstancesOfProcedure, org.eclipse.collections.impl.factory.HashingStrategySets, org.eclipse.collections.impl.lazy.AbstractLazyIterable, org.eclipse.collections.impl.lazy.parallel.AbstractBatch, .AbstractParallelIterable, org.eclipse.collections.impl.lazy.parallel.bag.CollectUnsortedBagBatch, .FlatCollectUnsortedBagBatch, .UnsortedBagBatch, org.eclipse.collections.impl.lazy.parallel.set.AbstractParallelUnsortedSetIterable, .RootUnsortedSetBatch, .SelectUnsortedSetBatch, .UnsortedSetBatch, org.eclipse.collections.impl.multimap.set.strategy.UnifiedSetWithHashingStrategyMultimap, org.eclipse.collections.impl.partition.set.strategy.PartitionUnifiedSetWithHashingStrategy, org.eclipse.collections.impl.set.AbstractUnifiedSet, org.eclipse.collections.impl.tuple.Tuples, org.eclipse.collections.impl.utility.Iterate

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
protected class
private class
private class

Field Summary

Modifier and TypeField and Description
protected HashingStrategy<? super T>
protected static final Object
protected transient int
private static final long
protected transient Object[]
Inherited from org.eclipse.collections.impl.set.AbstractUnifiedSet:
DEFAULT_INITIAL_CAPACITYDEFAULT_LOAD_FACTORloadFactormaxSize

Constructor Summary

AccessConstructor and Description
public
UnifiedSetWithHashingStrategy()
Deprecated No argument default constructor used for serialization. Instantiating an UnifiedSetWithHashingStrategyMultimap with this constructor will have a null hashingStrategy and throw NullPointerException when used.

public
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)

public
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int initialCapacity)

public
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int initialCapacity, float loadFactor)

public
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, Collection<? extends T> collection)

public

Method Summary

Modifier and TypeMethod and Description
public boolean
add(T key)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.add.

Implements java.util.Collection.add, java.util.Set.add.

Adds the specified element to this set if it is not already present (optional operation).

public boolean
private void
addForTrim(Object key, int oldIndex, int mask)

private void
private void
public T
addOrReplace(T key)

protected void
private void
public ParallelUnsortedSetIterable<T>
asParallel(ExecutorService executorService, int batchSize)

Implements org.eclipse.collections.api.set.UnsortedSetIterable.asParallel, org.eclipse.collections.api.set.SetIterable.asParallel.

Returns a parallel iterable of this SetIterable.

public void
batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)

Implements org.eclipse.collections.impl.parallel.BatchIterable.batchForEach.

private boolean
private boolean
chainedAdd(T key, int index)

private void
chainedAddForTrim(Object key, int index)

private T
private Object
private void
private <P> void
chainedForEachWith(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Procedure2<? super T, ? super P> procedure, P parameter)

private int
private T
private int
private T
chainedPut(T key, int index)

private boolean
chainedShortCircuit(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Predicate<? super T> predicate, boolean expected)

private <P> boolean
chainedShortCircuitWith(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Predicate2<? super T, ? super P> predicate, P parameter, boolean expected)

private void
public void
clear()

Implements java.util.Collection.clear, java.util.Set.clear, org.eclipse.collections.api.set.Pool.clear.

Removes all of the elements from this set (optional operation).

public UnifiedSetWithHashingStrategy<T>
clone()

Implements abstract org.eclipse.collections.impl.set.AbstractUnifiedSet.clone.

Implements org.eclipse.collections.api.set.MutableSet.clone.

Creates and returns a copy of this object.

public boolean
contains(Object key)

Overrides org.eclipse.collections.impl.AbstractRichIterable.contains.

Implements org.eclipse.collections.api.RichIterable.contains, java.util.Collection.contains, java.util.Set.contains.

Returns true if the iterable has an element which responds true to element.equals(object).

private int
private boolean
protected boolean
private void
copyToArray(Object[] result)

protected T
detect(Predicate<? super T> predicate, int start, int end)

Implements abstract org.eclipse.collections.impl.set.AbstractUnifiedSet.detect.

protected Optional<T>
detectOptional(Predicate<? super T> predicate, int start, int end)

Implements abstract org.eclipse.collections.impl.set.AbstractUnifiedSet.detectOptional.

public void
each(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.RichIterable.each.

The procedure is executed for each element in the iterable.

private void
ensureCapacity(int size)

public boolean
private int
fastCeil(float v)

public <P> void
forEachWith(Procedure2<? super T, ? super P> procedure, P parameter)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWith.

Implements org.eclipse.collections.api.InternalIterable.forEachWith.

The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.

public void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)

Overrides org.eclipse.collections.impl.AbstractRichIterable.forEachWithIndex.

Implements org.eclipse.collections.api.InternalIterable.forEachWithIndex.

Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.

public T
get(T key)

Implements org.eclipse.collections.api.set.Pool.get.

Locates an object in the pool which is equal to key.

public T
getFirst()

Implements org.eclipse.collections.api.RichIterable.getFirst.

Returns the first element of an iterable.

public T
getLast()

Implements org.eclipse.collections.api.RichIterable.getLast.

Returns the last element of an iterable.

private T
protected Object[]
public <V> UnifiedSetWithHashingStrategyMultimap<V, T>
groupBy(Function<? super T, ? extends V> function)

Implements org.eclipse.collections.api.set.MutableSet.groupBy, org.eclipse.collections.api.collection.MutableCollection.groupBy, org.eclipse.collections.api.RichIterable.groupBy.

For each element of the iterable, the function is evaluated and the results of these evaluations are collected into a new multimap, where the transformed value is the key and the original values are added to the same (or similar) species of collection as the source iterable.

public <V> UnifiedSetWithHashingStrategyMultimap<V, T>
groupByEach(Function<? super T, ? extends Iterable<V>> function)

Implements org.eclipse.collections.api.set.MutableSet.groupByEach, org.eclipse.collections.api.collection.MutableCollection.groupByEach, org.eclipse.collections.api.RichIterable.groupByEach.

Similar to groupBy(Function), except the result of evaluating function will return a collection of keys for each value.

public int
public HashingStrategy<? super T>
protected int
index(T key)

public Iterator<T>
iterator()

Implements java.lang.Iterable.iterator, java.util.Collection.iterator, java.util.Set.iterator.

Returns an iterator over elements of type T.

public <V> LazyIterable<V>
lazyCollect(Function<? super T, ? extends V> function)
Deprecated since 3.0.

public LazyIterable<T>
lazyReject(Predicate<? super T> predicate)
Deprecated since 3.0.

public LazyIterable<T>
lazySelect(Predicate<? super T> predicate)
Deprecated since 3.0.

public UnifiedSetWithHashingStrategy<T>
public UnifiedSetWithHashingStrategy<T>
public static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy)

public static <K> UnifiedSetWithHashingStrategy<K>
public static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy, int size)

public static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy, Iterable<? extends K> source)

public static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy, int size, float loadFactor)

public static <K> UnifiedSetWithHashingStrategy<K>
newSetWith(HashingStrategy<? super K> hashingStrategy, K... elements)

private boolean
private T
public PartitionMutableSet<T>
partition(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.MutableSet.partition, org.eclipse.collections.api.collection.MutableCollection.partition, org.eclipse.collections.api.RichIterable.partition.

Filters a collection into a PartitionedIterable based on the evaluation of the predicate.

public <P> PartitionMutableSet<T>
partitionWith(Predicate2<? super T, ? super P> predicate, P parameter)

Implements org.eclipse.collections.api.set.MutableSet.partitionWith, org.eclipse.collections.api.collection.MutableCollection.partitionWith, org.eclipse.collections.api.RichIterable.partitionWith.

Filters a collection into a PartitionIterable based on the evaluation of the predicate.

public T
put(T key)

Implements org.eclipse.collections.api.set.Pool.put.

Puts key into the pool.

public void
readExternal(ObjectInput in)

Implements java.io.Externalizable.readExternal.

The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.

protected void
public UnifiedSetWithHashingStrategy<T>
reject(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.MutableSet.reject, org.eclipse.collections.api.collection.MutableCollection.reject, org.eclipse.collections.api.RichIterable.reject.

Returns all elements of the source collection that return false when evaluating of the predicate.

public <P> UnifiedSetWithHashingStrategy<T>
rejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Implements org.eclipse.collections.api.set.MutableSet.rejectWith, org.eclipse.collections.api.collection.MutableCollection.rejectWith, org.eclipse.collections.api.RichIterable.rejectWith.

Similar to reject(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

public boolean
remove(Object key)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.remove.

Implements java.util.Collection.remove, java.util.Set.remove.

Removes the specified element from this set if it is present (optional operation).

private boolean
private T
private boolean
private T
public T
removeFromPool(T key)

Implements org.eclipse.collections.api.set.Pool.removeFromPool.

Locates an object in the pool which is equal to key and removes it.

private boolean
private boolean
retainAllFromSet(Set<?> collection)

public boolean
public UnifiedSetWithHashingStrategy<T>
select(Predicate<? super T> predicate)

Implements org.eclipse.collections.api.set.MutableSet.select, org.eclipse.collections.api.collection.MutableCollection.select, org.eclipse.collections.api.RichIterable.select.

Returns all elements of the source collection that return true when evaluating the predicate.

public <P> Twin<MutableList<T>>
selectAndRejectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Overrides org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection.selectAndRejectWith.

Implements org.eclipse.collections.api.collection.MutableCollection.selectAndRejectWith.

Filters a collection into two separate collections based on a predicate returned via a Pair.

public <S> UnifiedSetWithHashingStrategy<S>
public <P> UnifiedSetWithHashingStrategy<T>
selectWith(Predicate2<? super T, ? super P> predicate, P parameter)

Implements org.eclipse.collections.api.set.MutableSet.selectWith, org.eclipse.collections.api.collection.MutableCollection.selectWith, org.eclipse.collections.api.RichIterable.selectWith.

Similar to select(Predicate), except with an evaluation parameter for the second generic argument in Predicate2.

protected boolean
shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd, int start, int end)

Implements abstract org.eclipse.collections.impl.set.AbstractUnifiedSet.shortCircuit.

protected <P> boolean
shortCircuitWith(Predicate2<? super T, ? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)

Implements abstract org.eclipse.collections.impl.set.AbstractUnifiedSet.shortCircuitWith.

public int
public UnifiedSetWithHashingStrategy<T>
tap(Procedure<? super T> procedure)

Implements org.eclipse.collections.api.set.MutableSet.tap, org.eclipse.collections.api.collection.MutableCollection.tap, org.eclipse.collections.api.RichIterable.tap.

Executes the Procedure for each element in the iterable and returns this.

public Object[]
public <T> T[]
toArray(T[] array)

Overrides default org.eclipse.collections.api.RichIterable.toArray, org.eclipse.collections.api.set.MutableSetIterable.toArray, org.eclipse.collections.api.collection.MutableCollection.toArray.

Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.

public ImmutableSet<T>
private static Object
public boolean
public UnifiedSetWithHashingStrategy<T>
with(T element)

Overrides default org.eclipse.collections.api.set.MutableSet.with.

Implements org.eclipse.collections.api.collection.MutableCollection.with.

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

public UnifiedSetWithHashingStrategy<T>
with(T element1, T element2)

public UnifiedSetWithHashingStrategy<T>
with(T element1, T element2, T element3)

public UnifiedSetWithHashingStrategy<T>
with(T... elements)

Overrides default org.eclipse.collections.api.set.MutableSet.with.

Implements org.eclipse.collections.api.collection.MutableCollection.with.

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

public UnifiedSetWithHashingStrategy<T>
withAll(Iterable<? extends T> iterable)

Overrides default org.eclipse.collections.api.set.MutableSet.withAll.

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

public UnifiedSetWithHashingStrategy<T>
without(T element)

Overrides default org.eclipse.collections.api.set.MutableSet.without.

Implements org.eclipse.collections.api.collection.MutableCollection.without.

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

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

Overrides default org.eclipse.collections.api.set.MutableSet.withoutAll.

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

public void
writeExternal(ObjectOutput out)

Implements java.io.Externalizable.writeExternal.

The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

private void
Inherited from org.eclipse.collections.impl.set.AbstractUnifiedSet:
allocateallSatisfyallSatisfyWithanySatisfyanySatisfyWithasSynchronizedasUnmodifiablecartesianProductchunkcollectcollectIfcollectWithcomputeMaxSizedetectdetectOptionaldifferencedifferenceIntoflatCollectgetBatchCountgroupByUniqueKeyinitinjectIntoWithintersectintersectIntoisProperSubsetOfisSubsetOfnoneSatisfynoneSatisfyWithpowerSetrehashremoveAllIterableretainAllshortCircuitsymmetricDifferencesymmetricDifferenceIntounionunionIntozipzipWithIndex