Class UnifiedSetWithHashingStrategy<T>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection<T>
-
- org.eclipse.collections.impl.set.AbstractUnifiedSet<T>
-
- org.eclipse.collections.impl.set.strategy.mutable.UnifiedSetWithHashingStrategy<T>
-
- All Implemented Interfaces:
java.io.Externalizable
,java.io.Serializable
,java.lang.Cloneable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.Set<T>
,MutableCollection<T>
,InternalIterable<T>
,RichIterable<T>
,MutableSet<T>
,MutableSetIterable<T>
,Pool<T>
,SetIterable<T>
,UnsortedSetIterable<T>
,BatchIterable<T>
public class UnifiedSetWithHashingStrategy<T> extends AbstractUnifiedSet<T> implements java.io.Externalizable
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
UnifiedSetWithHashingStrategy.ChainedBucket
protected class
UnifiedSetWithHashingStrategy.PositionalIterator
private class
UnifiedSetWithHashingStrategy.UnifiedSetParallelUnsortedIterable
private class
UnifiedSetWithHashingStrategy.UnifiedUnsortedSetBatch
-
Field Summary
Fields Modifier and Type Field Description protected HashingStrategy<? super T>
hashingStrategy
protected static java.lang.Object
NULL_KEY
protected int
occupied
private static long
serialVersionUID
protected java.lang.Object[]
table
-
Fields inherited from class org.eclipse.collections.impl.set.AbstractUnifiedSet
DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR, loadFactor, maxSize
-
-
Constructor Summary
Constructors Constructor Description UnifiedSetWithHashingStrategy()
Deprecated.No argument default constructor used for serialization.UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int initialCapacity)
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int initialCapacity, float loadFactor)
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, java.util.Collection<? extends T> collection)
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, UnifiedSetWithHashingStrategy<T> set)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
add(T key)
boolean
addAllIterable(java.lang.Iterable<? extends T> iterable)
private void
addForTrim(java.lang.Object key, int oldIndex, int mask)
private void
addIfFound(T key, UnifiedSetWithHashingStrategy<T> other)
private void
addIfFoundFromChain(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key, UnifiedSetWithHashingStrategy<T> other)
T
addOrReplace(T key)
protected void
allocateTable(int sizeToAllocate)
private void
appendNewChainedBucket(UnifiedSetWithHashingStrategy.ChainedBucket bucket, java.lang.Object o)
ParallelUnsortedSetIterable<T>
asParallel(java.util.concurrent.ExecutorService executorService, int batchSize)
Returns a parallel iterable of this SetIterable.void
batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)
private boolean
chainContains(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key)
private boolean
chainedAdd(T key, int index)
private void
chainedAddForTrim(java.lang.Object key, int index)
private T
chainedAddOrReplace(T key, UnifiedSetWithHashingStrategy.ChainedBucket bucket, int index)
private java.lang.Object
chainedDetect(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Predicate<? super T> predicate)
private void
chainedForEach(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Procedure<? super T> procedure)
private <P> void
chainedForEachWith(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Procedure2<? super T,? super P> procedure, P parameter)
private int
chainedForEachWithIndex(UnifiedSetWithHashingStrategy.ChainedBucket bucket, ObjectIntProcedure<? super T> procedure, int count)
private T
chainedGet(T key, UnifiedSetWithHashingStrategy.ChainedBucket bucket)
private int
chainedHashCode(UnifiedSetWithHashingStrategy.ChainedBucket bucket)
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
chainedTrimToSize(UnifiedSetWithHashingStrategy.ChainedBucket bucket, int oldIndex, int mask)
void
clear()
UnifiedSetWithHashingStrategy<T>
clone()
boolean
contains(java.lang.Object key)
Returns true if the iterable has an element which responds true to element.equals(object).private int
copyBucketToArray(java.lang.Object[] result, UnifiedSetWithHashingStrategy.ChainedBucket bucket, int count)
private boolean
copyChain(UnifiedSetWithHashingStrategy.ChainedBucket bucket)
protected boolean
copySet(UnifiedSetWithHashingStrategy<?> unifiedset)
private void
copyToArray(java.lang.Object[] result)
protected T
detect(Predicate<? super T> predicate, int start, int end)
protected java.util.Optional<T>
detectOptional(Predicate<? super T> predicate, int start, int end)
void
each(Procedure<? super T> procedure)
The procedure is executed for each element in the iterable.private void
ensureCapacity(int size)
boolean
equals(java.lang.Object object)
Follows the same general contract asSet.equals(Object)
.private int
fastCeil(float v)
<P> void
forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.void
forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.T
get(T key)
Locates an object in the pool which is equal tokey
.T
getFirst()
Returns the first element of an iterable.T
getLast()
Returns the last element of an iterable.private T
getLast(UnifiedSetWithHashingStrategy.ChainedBucket bucket)
protected java.lang.Object[]
getTable()
<V> UnifiedSetWithHashingStrategyMultimap<V,T>
groupBy(Function<? super T,? extends V> function)
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.<V> UnifiedSetWithHashingStrategyMultimap<V,T>
groupByEach(Function<? super T,? extends java.lang.Iterable<V>> function)
Similar toRichIterable.groupBy(Function)
, except the result of evaluating function will return a collection of keys for each value.int
hashCode()
Follows the same general contract asSet.hashCode()
.HashingStrategy<? super T>
hashingStrategy()
protected int
index(T key)
java.util.Iterator<T>
iterator()
<V> LazyIterable<V>
lazyCollect(Function<? super T,? extends V> function)
Deprecated.since 3.0.LazyIterable<T>
lazyReject(Predicate<? super T> predicate)
Deprecated.since 3.0.LazyIterable<T>
lazySelect(Predicate<? super T> predicate)
Deprecated.since 3.0.UnifiedSetWithHashingStrategy<T>
newEmpty()
Creates a new empty mutable version of the same collection type.UnifiedSetWithHashingStrategy<T>
newEmpty(int size)
static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy)
static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy, int size)
static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy, int size, float loadFactor)
static <K> UnifiedSetWithHashingStrategy<K>
newSet(HashingStrategy<? super K> hashingStrategy, java.lang.Iterable<? extends K> source)
static <K> UnifiedSetWithHashingStrategy<K>
newSet(UnifiedSetWithHashingStrategy<K> set)
static <K> UnifiedSetWithHashingStrategy<K>
newSetWith(HashingStrategy<? super K> hashingStrategy, K... elements)
private boolean
nonNullTableObjectEquals(java.lang.Object cur, T key)
private T
nonSentinel(java.lang.Object key)
PartitionMutableSet<T>
partition(Predicate<? super T> predicate)
Filters a collection into a PartitionedIterable based on the evaluation of the predicate.<P> PartitionMutableSet<T>
partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
Filters a collection into a PartitionIterable based on the evaluation of the predicate.T
put(T key)
Putskey
into the pool.void
readExternal(java.io.ObjectInput in)
protected void
rehash(int newCapacity)
UnifiedSetWithHashingStrategy<T>
reject(Predicate<? super T> predicate)
Returns all elements of the source collection that return false when evaluating of the predicate.<P> UnifiedSetWithHashingStrategy<T>
rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
Similar toRichIterable.reject(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.boolean
remove(java.lang.Object key)
private boolean
removeDeepChain(UnifiedSetWithHashingStrategy.ChainedBucket oldBucket, T key)
private T
removeDeepChainForPool(UnifiedSetWithHashingStrategy.ChainedBucket oldBucket, T key)
private boolean
removeFromChain(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key, int index)
private T
removeFromChainForPool(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key, int index)
T
removeFromPool(T key)
Locates an object in the pool which is equal tokey
and removes it.private boolean
retainAllFromNonSet(java.lang.Iterable<?> iterable)
private boolean
retainAllFromSet(java.util.Set<?> collection)
boolean
retainAllIterable(java.lang.Iterable<?> iterable)
UnifiedSetWithHashingStrategy<T>
select(Predicate<? super T> predicate)
Returns all elements of the source collection that return true when evaluating the predicate.<P> Twin<MutableList<T>>
selectAndRejectWith(Predicate2<? super T,? super P> predicate, P parameter)
Filters a collection into two separate collections based on a predicate returned via a Pair.<S> UnifiedSetWithHashingStrategy<S>
selectInstancesOf(java.lang.Class<S> clazz)
Returns all elements of the source collection that are instances of the Classclazz
.<P> UnifiedSetWithHashingStrategy<T>
selectWith(Predicate2<? super T,? super P> predicate, P parameter)
Similar toRichIterable.select(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.protected boolean
shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd, int start, int end)
protected <P> boolean
shortCircuitWith(Predicate2<? super T,? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)
int
size()
Returns the number of items in this iterable.UnifiedSetWithHashingStrategy<T>
tap(Procedure<? super T> procedure)
Executes the Procedure for each element in the iterable and returnsthis
.java.lang.Object[]
toArray()
Converts this iterable to an array.<T> T[]
toArray(T[] array)
Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.ImmutableSet<T>
toImmutable()
Returns an immutable copy of this set.private static java.lang.Object
toSentinelIfNull(java.lang.Object key)
boolean
trimToSize()
UnifiedSetWithHashingStrategy<T>
with(T element)
This method allows mutable and fixed size collections the ability to add elements to their existing elements.UnifiedSetWithHashingStrategy<T>
with(T... elements)
UnifiedSetWithHashingStrategy<T>
with(T element1, T element2)
UnifiedSetWithHashingStrategy<T>
with(T element1, T element2, T element3)
UnifiedSetWithHashingStrategy<T>
withAll(java.lang.Iterable<? extends T> iterable)
This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.UnifiedSetWithHashingStrategy<T>
without(T element)
This method allows mutable and fixed size collections the ability to remove elements from their existing elements.UnifiedSetWithHashingStrategy<T>
withoutAll(java.lang.Iterable<? extends T> elements)
This method allows mutable and fixed size collections the ability to remove multiple elements from their existing elements.void
writeExternal(java.io.ObjectOutput out)
private void
writeExternalChain(java.io.ObjectOutput out, UnifiedSetWithHashingStrategy.ChainedBucket bucket)
-
Methods inherited from class org.eclipse.collections.impl.set.AbstractUnifiedSet
allocate, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asSynchronized, asUnmodifiable, cartesianProduct, chunk, collect, collectIf, collectWith, computeMaxSize, detect, detectOptional, difference, differenceInto, flatCollect, getBatchCount, groupByUniqueKey, init, injectIntoWith, intersect, intersectInto, isProperSubsetOf, isSubsetOf, noneSatisfy, noneSatisfyWith, powerSet, rehash, removeAllIterable, retainAll, shortCircuit, symmetricDifference, symmetricDifferenceInto, union, unionInto, zip, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection
addAll, countBy, countByEach, countByWith, reduce, removeAll, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
appendString, appendString, asLazy, collect, collectIf, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countWith, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, max, max, maxBy, min, min, minBy, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toList, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.impl.parallel.BatchIterable
forEach
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
aggregateBy, aggregateInPlaceBy, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, countBy, countByEach, countByWith, flatCollectWith, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from interface org.eclipse.collections.api.set.MutableSet
collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectInt, collectLong, collectShort, flatCollectWith, toImmutableSet
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, appendString, appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detectIfNone, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, 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, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toBag, toBiMap, toImmutableBag, toImmutableBiMap, toImmutableList, toImmutableMap, 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, zipWithIndex
-
-
-
-
Field Detail
-
NULL_KEY
protected static final java.lang.Object NULL_KEY
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
table
protected transient java.lang.Object[] table
-
occupied
protected transient int occupied
-
hashingStrategy
protected HashingStrategy<? super T> hashingStrategy
-
-
Constructor Detail
-
UnifiedSetWithHashingStrategy
@Deprecated 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.
-
UnifiedSetWithHashingStrategy
public UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy)
-
UnifiedSetWithHashingStrategy
public UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int initialCapacity)
-
UnifiedSetWithHashingStrategy
public UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, int initialCapacity, float loadFactor)
-
UnifiedSetWithHashingStrategy
public UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, java.util.Collection<? extends T> collection)
-
UnifiedSetWithHashingStrategy
public UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, UnifiedSetWithHashingStrategy<T> set)
-
-
Method Detail
-
newSet
public static <K> UnifiedSetWithHashingStrategy<K> newSet(HashingStrategy<? super K> hashingStrategy)
-
newSet
public static <K> UnifiedSetWithHashingStrategy<K> newSet(UnifiedSetWithHashingStrategy<K> set)
-
newSet
public static <K> UnifiedSetWithHashingStrategy<K> newSet(HashingStrategy<? super K> hashingStrategy, int size)
-
newSet
public static <K> UnifiedSetWithHashingStrategy<K> newSet(HashingStrategy<? super K> hashingStrategy, java.lang.Iterable<? extends K> source)
-
newSet
public static <K> UnifiedSetWithHashingStrategy<K> newSet(HashingStrategy<? super K> hashingStrategy, int size, float loadFactor)
-
newSetWith
public static <K> UnifiedSetWithHashingStrategy<K> newSetWith(HashingStrategy<? super K> hashingStrategy, K... elements)
-
hashingStrategy
public HashingStrategy<? super T> hashingStrategy()
-
fastCeil
private int fastCeil(float v)
-
getTable
protected java.lang.Object[] getTable()
- Specified by:
getTable
in classAbstractUnifiedSet<T>
-
allocateTable
protected void allocateTable(int sizeToAllocate)
- Specified by:
allocateTable
in classAbstractUnifiedSet<T>
-
index
protected int index(T key)
-
clear
public void clear()
-
add
public boolean add(T key)
- Specified by:
add
in interfacejava.util.Collection<T>
- Specified by:
add
in interfacejava.util.Set<T>
- Overrides:
add
in classAbstractMutableCollection<T>
-
chainedAdd
private boolean chainedAdd(T key, int index)
-
appendNewChainedBucket
private void appendNewChainedBucket(UnifiedSetWithHashingStrategy.ChainedBucket bucket, java.lang.Object o)
-
rehash
protected void rehash(int newCapacity)
- Specified by:
rehash
in classAbstractUnifiedSet<T>
-
contains
public boolean contains(java.lang.Object key)
Description copied from interface:RichIterable
Returns true if the iterable has an element which responds true to element.equals(object).- Specified by:
contains
in interfacejava.util.Collection<T>
- Specified by:
contains
in interfaceRichIterable<T>
- Specified by:
contains
in interfacejava.util.Set<T>
- Overrides:
contains
in classAbstractRichIterable<T>
-
chainContains
private boolean chainContains(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key)
-
batchForEach
public void batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)
- Specified by:
batchForEach
in interfaceBatchIterable<T>
-
tap
public UnifiedSetWithHashingStrategy<T> tap(Procedure<? super T> procedure)
Description copied from interface:RichIterable
Executes the Procedure for each element in the iterable and returnsthis
.Example using a Java 8 lambda expression:
RichIterable<Person> tapped = people.tap(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
RichIterable<Person> tapped = people.tap(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
- Specified by:
tap
in interfaceMutableCollection<T>
- Specified by:
tap
in interfaceMutableSet<T>
- Specified by:
tap
in interfaceMutableSetIterable<T>
- Specified by:
tap
in interfaceRichIterable<T>
- Specified by:
tap
in interfaceSetIterable<T>
- Specified by:
tap
in interfaceUnsortedSetIterable<T>
- See Also:
RichIterable.each(Procedure)
,RichIterable.forEach(Procedure)
-
each
public void each(Procedure<? super T> procedure)
Description copied from interface:RichIterable
The procedure is executed for each element in the iterable.Example using a Java 8 lambda expression:
people.each(person -> LOGGER.info(person.getName()));
Example using an anonymous inner class:
people.each(new Procedure<Person>() { public void value(Person person) { LOGGER.info(person.getName()); } });
This method is a variant ofInternalIterable.forEach(Procedure)
that has a signature conflict withIterable.forEach(java.util.function.Consumer)
.- Specified by:
each
in interfaceRichIterable<T>
- See Also:
InternalIterable.forEach(Procedure)
,Iterable.forEach(java.util.function.Consumer)
-
chainedForEach
private void chainedForEach(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Procedure<? super T> procedure)
-
forEachWith
public <P> void forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
Description copied from interface:InternalIterable
The procedure2 is evaluated for each element in the iterable with the specified parameter provided as the second argument.Example using a Java 8 lambda:
people.forEachWith((Person person, Person other) -> { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } }, fred);
Example using an anonymous inner class:
people.forEachWith(new Procedure2<Person, Person>() { public void value(Person person, Person other) { if (person.isRelatedTo(other)) { LOGGER.info(person.getName()); } } }, fred);
- Specified by:
forEachWith
in interfaceInternalIterable<T>
- Overrides:
forEachWith
in classAbstractRichIterable<T>
-
chainedForEachWith
private <P> void chainedForEachWith(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Procedure2<? super T,? super P> procedure, P parameter)
-
forEachWithIndex
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
Description copied from interface:InternalIterable
Iterates over the iterable passing each element and the current relative int index to the specified instance of ObjectIntProcedure.Example using a Java 8 lambda:
people.forEachWithIndex((Person person, int index) -> LOGGER.info("Index: " + index + " person: " + person.getName()));
Example using an anonymous inner class:
people.forEachWithIndex(new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info("Index: " + index + " person: " + person.getName()); } });
- Specified by:
forEachWithIndex
in interfaceInternalIterable<T>
- Overrides:
forEachWithIndex
in classAbstractRichIterable<T>
-
chainedForEachWithIndex
private int chainedForEachWithIndex(UnifiedSetWithHashingStrategy.ChainedBucket bucket, ObjectIntProcedure<? super T> procedure, int count)
-
newEmpty
public UnifiedSetWithHashingStrategy<T> newEmpty()
Description copied from interface:MutableCollection
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.- Specified by:
newEmpty
in interfaceMutableCollection<T>
- Specified by:
newEmpty
in interfaceMutableSet<T>
-
newEmpty
public UnifiedSetWithHashingStrategy<T> newEmpty(int size)
- Specified by:
newEmpty
in classAbstractUnifiedSet<T>
-
getFirst
public T getFirst()
Description copied from interface:RichIterable
Returns the first element of an iterable. In the case of a List it is the element at the first index. In the case of any other Collection, it is the first element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the first element could be any element from the Set.
- Specified by:
getFirst
in interfaceRichIterable<T>
-
getLast
public T getLast()
Description copied from interface:RichIterable
Returns the last element of an iterable. In the case of a List it is the element at the last index. In the case of any other Collection, it is the last element that would be returned during an iteration. If the iterable is empty, null is returned. If null is a valid element of the container, then a developer would need to check to see if the iterable is empty to validate that a null result was not due to the container being empty.The order of Sets are not guaranteed (except for TreeSets and other Ordered Set implementations), so if you use this method, the last element could be any element from the Set.
- Specified by:
getLast
in interfaceRichIterable<T>
-
getLast
private T getLast(UnifiedSetWithHashingStrategy.ChainedBucket bucket)
-
select
public UnifiedSetWithHashingStrategy<T> select(Predicate<? super T> predicate)
Description copied from interface:RichIterable
Returns all elements of the source collection that return true when evaluating the predicate. This method is also commonly called filter.Example using a Java 8 lambda expression:
RichIterable<Person> selected = people.select(person -> person.getAddress().getCity().equals("London"));
Example using an anonymous inner class:
RichIterable<Person> selected = people.select(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getCity().equals("London"); } });
- Specified by:
select
in interfaceMutableCollection<T>
- Specified by:
select
in interfaceMutableSet<T>
- Specified by:
select
in interfaceMutableSetIterable<T>
- Specified by:
select
in interfaceRichIterable<T>
- Specified by:
select
in interfaceSetIterable<T>
- Specified by:
select
in interfaceUnsortedSetIterable<T>
-
selectWith
public <P> UnifiedSetWithHashingStrategy<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:RichIterable
Similar toRichIterable.select(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.E.g. return a
Collection
of Person elements where the person has an age greater than or equal to 18 yearsExample using a Java 8 lambda expression:
RichIterable<Person> selected = people.selectWith((Person person, Integer age) -> person.getAge()>= age, Integer.valueOf(18));
Example using an anonymous inner class:
RichIterable<Person> selected = people.selectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge()>= age; } }, Integer.valueOf(18));
- Specified by:
selectWith
in interfaceMutableCollection<T>
- Specified by:
selectWith
in interfaceMutableSet<T>
- Specified by:
selectWith
in interfaceMutableSetIterable<T>
- Specified by:
selectWith
in interfaceRichIterable<T>
- Specified by:
selectWith
in interfaceSetIterable<T>
- Specified by:
selectWith
in interfaceUnsortedSetIterable<T>
- Parameters:
predicate
- aPredicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argumentP
inpredicate
- See Also:
RichIterable.select(Predicate)
-
reject
public UnifiedSetWithHashingStrategy<T> reject(Predicate<? super T> predicate)
Description copied from interface:RichIterable
Returns all elements of the source collection that return false when evaluating of the predicate. This method is also sometimes called filterNot and is the equivalent of calling iterable.select(Predicates.not(predicate)).Example using a Java 8 lambda expression:
RichIterable<Person> rejected = people.reject(person -> person.person.getLastName().equals("Smith"));
Example using an anonymous inner class:
RichIterable<Person> rejected = people.reject(new Predicate<Person>() { public boolean accept(Person person) { return person.person.getLastName().equals("Smith"); } });
- Specified by:
reject
in interfaceMutableCollection<T>
- Specified by:
reject
in interfaceMutableSet<T>
- Specified by:
reject
in interfaceMutableSetIterable<T>
- Specified by:
reject
in interfaceRichIterable<T>
- Specified by:
reject
in interfaceSetIterable<T>
- Specified by:
reject
in interfaceUnsortedSetIterable<T>
- Parameters:
predicate
- aPredicate
to use as the reject criteria- Returns:
- a RichIterable that contains elements that cause
Predicate.accept(Object)
method to evaluate to false
-
rejectWith
public <P> UnifiedSetWithHashingStrategy<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:RichIterable
Similar toRichIterable.reject(Predicate)
, except with an evaluation parameter for the second generic argument inPredicate2
.E.g. return a
Collection
of Person elements where the person has an age greater than or equal to 18 yearsExample using a Java 8 lambda expression:
RichIterable<Person> rejected = people.rejectWith((Person person, Integer age) -> person.getAge() < age, Integer.valueOf(18));
Example using an anonymous inner class:
MutableList<Person> rejected = people.rejectWith(new Predicate2<Person, Integer>() { public boolean accept(Person person, Integer age) { return person.getAge() < age; } }, Integer.valueOf(18));
- Specified by:
rejectWith
in interfaceMutableCollection<T>
- Specified by:
rejectWith
in interfaceMutableSet<T>
- Specified by:
rejectWith
in interfaceMutableSetIterable<T>
- Specified by:
rejectWith
in interfaceRichIterable<T>
- Specified by:
rejectWith
in interfaceSetIterable<T>
- Specified by:
rejectWith
in interfaceUnsortedSetIterable<T>
- Parameters:
predicate
- aPredicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argumentP
inpredicate
- See Also:
RichIterable.select(Predicate)
-
selectAndRejectWith
public <P> Twin<MutableList<T>> selectAndRejectWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:MutableCollection
Filters a collection into two separate collections based on a predicate returned via a Pair.e.g. return lastNames.selectAndRejectWith(Predicates2.lessThan(), "Mason");
- Specified by:
selectAndRejectWith
in interfaceMutableCollection<T>
- Overrides:
selectAndRejectWith
in classAbstractMutableCollection<T>
-
partition
public PartitionMutableSet<T> partition(Predicate<? super T> predicate)
Description copied from interface:RichIterable
Filters a collection into a PartitionedIterable based on the evaluation of the predicate.Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(person -> person.getAddress().getState().getName().equals("New York"));
Example using an anonymous inner class:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partition(new Predicate<Person>() { public boolean accept(Person person) { return person.getAddress().getState().getName().equals("New York"); } });
- Specified by:
partition
in interfaceMutableCollection<T>
- Specified by:
partition
in interfaceMutableSet<T>
- Specified by:
partition
in interfaceMutableSetIterable<T>
- Specified by:
partition
in interfaceRichIterable<T>
- Specified by:
partition
in interfaceSetIterable<T>
-
partitionWith
public <P> PartitionMutableSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:RichIterable
Filters a collection into a PartitionIterable based on the evaluation of the predicate.Example using a Java 8 lambda expression:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partitionWith((Person person, String state) -> person.getAddress().getState().getName().equals(state), "New York");
Example using an anonymous inner class:
PartitionIterable<Person> newYorkersAndNonNewYorkers = people.partitionWith(new Predicate2<Person, String>() { public boolean accept(Person person, String state) { return person.getAddress().getState().getName().equals(state); } }, "New York");
- Specified by:
partitionWith
in interfaceMutableCollection<T>
- Specified by:
partitionWith
in interfaceMutableSet<T>
- Specified by:
partitionWith
in interfaceMutableSetIterable<T>
- Specified by:
partitionWith
in interfaceRichIterable<T>
- Specified by:
partitionWith
in interfaceSetIterable<T>
-
selectInstancesOf
public <S> UnifiedSetWithHashingStrategy<S> selectInstancesOf(java.lang.Class<S> clazz)
Description copied from interface:RichIterable
Returns all elements of the source collection that are instances of the Classclazz
.RichIterable<Integer> integers = List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
- Specified by:
selectInstancesOf
in interfaceMutableCollection<T>
- Specified by:
selectInstancesOf
in interfaceMutableSet<T>
- Specified by:
selectInstancesOf
in interfaceMutableSetIterable<T>
- Specified by:
selectInstancesOf
in interfaceRichIterable<T>
- Specified by:
selectInstancesOf
in interfaceSetIterable<T>
- Specified by:
selectInstancesOf
in interfaceUnsortedSetIterable<T>
-
detect
protected T detect(Predicate<? super T> predicate, int start, int end)
- Specified by:
detect
in classAbstractUnifiedSet<T>
-
detectOptional
protected java.util.Optional<T> detectOptional(Predicate<? super T> predicate, int start, int end)
- Specified by:
detectOptional
in classAbstractUnifiedSet<T>
-
chainedDetect
private java.lang.Object chainedDetect(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Predicate<? super T> predicate)
-
shortCircuit
protected boolean shortCircuit(Predicate<? super T> predicate, boolean expected, boolean onShortCircuit, boolean atEnd, int start, int end)
- Specified by:
shortCircuit
in classAbstractUnifiedSet<T>
-
chainedShortCircuit
private boolean chainedShortCircuit(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Predicate<? super T> predicate, boolean expected)
-
shortCircuitWith
protected <P> boolean shortCircuitWith(Predicate2<? super T,? super P> predicate2, P parameter, boolean expected, boolean onShortCircuit, boolean atEnd)
- Specified by:
shortCircuitWith
in classAbstractUnifiedSet<T>
-
chainedShortCircuitWith
private <P> boolean chainedShortCircuitWith(UnifiedSetWithHashingStrategy.ChainedBucket bucket, Predicate2<? super T,? super P> predicate, P parameter, boolean expected)
-
lazySelect
@Deprecated public LazyIterable<T> lazySelect(Predicate<? super T> predicate)
Deprecated.since 3.0. UseAbstractRichIterable.asLazy()
.select(Predicate)
instead.
-
lazyReject
@Deprecated public LazyIterable<T> lazyReject(Predicate<? super T> predicate)
Deprecated.since 3.0. UseAbstractRichIterable.asLazy()
.reject(Predicate)
instead.
-
lazyCollect
@Deprecated public <V> LazyIterable<V> lazyCollect(Function<? super T,? extends V> function)
Deprecated.since 3.0. UseAbstractRichIterable.asLazy()
.AbstractUnifiedSet.collect(Function)
instead.
-
toImmutable
public ImmutableSet<T> toImmutable()
Description copied from interface:MutableSet
Returns an immutable copy of this set. If the set is immutable, it returns itself.- Specified by:
toImmutable
in interfaceMutableCollection<T>
- Specified by:
toImmutable
in interfaceMutableSet<T>
- Specified by:
toImmutable
in interfaceSetIterable<T>
- Specified by:
toImmutable
in interfaceUnsortedSetIterable<T>
-
with
public UnifiedSetWithHashingStrategy<T> with(T element)
Description copied from interface:MutableCollection
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 ofFixedSizeCollection
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.- Specified by:
with
in interfaceMutableCollection<T>
- Specified by:
with
in interfaceMutableSet<T>
- Specified by:
with
in interfaceMutableSetIterable<T>
- See Also:
Collection.add(Object)
-
with
public UnifiedSetWithHashingStrategy<T> with(T element1, T element2)
-
with
public UnifiedSetWithHashingStrategy<T> with(T element1, T element2, T element3)
-
with
public UnifiedSetWithHashingStrategy<T> with(T... elements)
-
withAll
public UnifiedSetWithHashingStrategy<T> withAll(java.lang.Iterable<? extends T> iterable)
Description copied from interface:MutableCollection
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 ofFixedSizeCollection
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.- Specified by:
withAll
in interfaceMutableCollection<T>
- Specified by:
withAll
in interfaceMutableSet<T>
- Specified by:
withAll
in interfaceMutableSetIterable<T>
- See Also:
Collection.addAll(Collection)
-
without
public UnifiedSetWithHashingStrategy<T> without(T element)
Description copied from interface:MutableCollection
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 ofFixedSizeCollection
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.- Specified by:
without
in interfaceMutableCollection<T>
- Specified by:
without
in interfaceMutableSet<T>
- Specified by:
without
in interfaceMutableSetIterable<T>
- See Also:
Collection.remove(Object)
-
withoutAll
public UnifiedSetWithHashingStrategy<T> withoutAll(java.lang.Iterable<? extends T> elements)
Description copied from interface:MutableCollection
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 ofFixedSizeCollection
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.- Specified by:
withoutAll
in interfaceMutableCollection<T>
- Specified by:
withoutAll
in interfaceMutableSet<T>
- Specified by:
withoutAll
in interfaceMutableSetIterable<T>
- See Also:
Collection.removeAll(Collection)
-
addAllIterable
public boolean addAllIterable(java.lang.Iterable<? extends T> iterable)
- Specified by:
addAllIterable
in interfaceMutableCollection<T>
- Overrides:
addAllIterable
in classAbstractMutableCollection<T>
- See Also:
Collection.addAll(Collection)
-
ensureCapacity
private void ensureCapacity(int size)
-
copySet
protected boolean copySet(UnifiedSetWithHashingStrategy<?> unifiedset)
-
copyChain
private boolean copyChain(UnifiedSetWithHashingStrategy.ChainedBucket bucket)
-
remove
public boolean remove(java.lang.Object key)
- Specified by:
remove
in interfacejava.util.Collection<T>
- Specified by:
remove
in interfacejava.util.Set<T>
- Overrides:
remove
in classAbstractMutableCollection<T>
-
removeFromChain
private boolean removeFromChain(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key, int index)
-
removeDeepChain
private boolean removeDeepChain(UnifiedSetWithHashingStrategy.ChainedBucket oldBucket, T key)
-
size
public int size()
Description copied from interface:RichIterable
Returns the number of items in this iterable.
-
equals
public boolean equals(java.lang.Object object)
Description copied from interface:SetIterable
Follows the same general contract asSet.equals(Object)
.- Specified by:
equals
in interfacejava.util.Collection<T>
- Specified by:
equals
in interfacejava.util.Set<T>
- Specified by:
equals
in interfaceSetIterable<T>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Description copied from interface:SetIterable
Follows the same general contract asSet.hashCode()
.- Specified by:
hashCode
in interfacejava.util.Collection<T>
- Specified by:
hashCode
in interfacejava.util.Set<T>
- Specified by:
hashCode
in interfaceSetIterable<T>
- Overrides:
hashCode
in classjava.lang.Object
-
chainedHashCode
private int chainedHashCode(UnifiedSetWithHashingStrategy.ChainedBucket bucket)
-
trimToSize
public boolean trimToSize()
-
chainedTrimToSize
private void chainedTrimToSize(UnifiedSetWithHashingStrategy.ChainedBucket bucket, int oldIndex, int mask)
-
addForTrim
private void addForTrim(java.lang.Object key, int oldIndex, int mask)
-
chainedAddForTrim
private void chainedAddForTrim(java.lang.Object key, int index)
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
- Specified by:
readExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
java.lang.ClassNotFoundException
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
- Specified by:
writeExternal
in interfacejava.io.Externalizable
- Throws:
java.io.IOException
-
writeExternalChain
private void writeExternalChain(java.io.ObjectOutput out, UnifiedSetWithHashingStrategy.ChainedBucket bucket) throws java.io.IOException
- Throws:
java.io.IOException
-
addIfFound
private void addIfFound(T key, UnifiedSetWithHashingStrategy<T> other)
-
addIfFoundFromChain
private void addIfFoundFromChain(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key, UnifiedSetWithHashingStrategy<T> other)
-
retainAllIterable
public boolean retainAllIterable(java.lang.Iterable<?> iterable)
- Specified by:
retainAllIterable
in interfaceMutableCollection<T>
- Overrides:
retainAllIterable
in classAbstractMutableCollection<T>
- See Also:
Collection.retainAll(Collection)
-
retainAllFromNonSet
private boolean retainAllFromNonSet(java.lang.Iterable<?> iterable)
-
retainAllFromSet
private boolean retainAllFromSet(java.util.Set<?> collection)
-
clone
public UnifiedSetWithHashingStrategy<T> clone()
- Specified by:
clone
in interfaceMutableSet<T>
- Specified by:
clone
in classAbstractUnifiedSet<T>
-
toArray
public java.lang.Object[] toArray()
Description copied from interface:RichIterable
Converts this iterable to an array.- Specified by:
toArray
in interfacejava.util.Collection<T>
- Specified by:
toArray
in interfaceRichIterable<T>
- Specified by:
toArray
in interfacejava.util.Set<T>
- Overrides:
toArray
in classAbstractRichIterable<T>
- See Also:
Collection.toArray()
-
copyToArray
private void copyToArray(java.lang.Object[] result)
-
copyBucketToArray
private int copyBucketToArray(java.lang.Object[] result, UnifiedSetWithHashingStrategy.ChainedBucket bucket, int count)
-
toArray
public <T> T[] toArray(T[] array)
Description copied from interface:RichIterable
Converts this iterable to an array using the specified target array, assuming the target array is as long or longer than the iterable.- Specified by:
toArray
in interfacejava.util.Collection<T>
- Specified by:
toArray
in interfaceRichIterable<T>
- Specified by:
toArray
in interfacejava.util.Set<T>
- Overrides:
toArray
in classAbstractRichIterable<T>
- See Also:
Collection.toArray(Object[])
-
iterator
public java.util.Iterator<T> iterator()
-
groupBy
public <V> UnifiedSetWithHashingStrategyMultimap<V,T> groupBy(Function<? super T,? extends V> function)
Description copied from interface:RichIterable
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.Example using a Java 8 method reference:
Multimap<String, Person> peopleByLastName = people.groupBy(Person::getLastName);
Example using an anonymous inner class:
Multimap<String, Person> peopleByLastName = people.groupBy(new Function<Person, String>() { public String valueOf(Person person) { return person.getLastName(); } });
- Specified by:
groupBy
in interfaceMutableCollection<T>
- Specified by:
groupBy
in interfaceMutableSet<T>
- Specified by:
groupBy
in interfaceMutableSetIterable<T>
- Specified by:
groupBy
in interfaceRichIterable<T>
- Specified by:
groupBy
in interfaceUnsortedSetIterable<T>
-
groupByEach
public <V> UnifiedSetWithHashingStrategyMultimap<V,T> groupByEach(Function<? super T,? extends java.lang.Iterable<V>> function)
Description copied from interface:RichIterable
Similar toRichIterable.groupBy(Function)
, except the result of evaluating function will return a collection of keys for each value.- Specified by:
groupByEach
in interfaceMutableCollection<T>
- Specified by:
groupByEach
in interfaceMutableSet<T>
- Specified by:
groupByEach
in interfaceMutableSetIterable<T>
- Specified by:
groupByEach
in interfaceRichIterable<T>
- Specified by:
groupByEach
in interfaceUnsortedSetIterable<T>
-
get
public T get(T key)
Description copied from interface:Pool
Locates an object in the pool which is equal tokey
.
-
chainedGet
private T chainedGet(T key, UnifiedSetWithHashingStrategy.ChainedBucket bucket)
-
chainedAddOrReplace
private T chainedAddOrReplace(T key, UnifiedSetWithHashingStrategy.ChainedBucket bucket, int index)
-
put
public T put(T key)
Description copied from interface:Pool
Putskey
into the pool. If there is no existing object that is equal to key, key will be added to the pool and the return value will be the same instance. If there is an existing object in the pool that is equal tokey
, the pool will remain unchanged and the pooled instance will be is returned.
-
removeFromPool
public T removeFromPool(T key)
Description copied from interface:Pool
Locates an object in the pool which is equal tokey
and removes it.- Specified by:
removeFromPool
in interfacePool<T>
- Parameters:
key
- object to remove- Returns:
- The object reference in the pool equal to key or null.
-
removeFromChainForPool
private T removeFromChainForPool(UnifiedSetWithHashingStrategy.ChainedBucket bucket, T key, int index)
-
removeDeepChainForPool
private T removeDeepChainForPool(UnifiedSetWithHashingStrategy.ChainedBucket oldBucket, T key)
-
nonSentinel
private T nonSentinel(java.lang.Object key)
-
toSentinelIfNull
private static java.lang.Object toSentinelIfNull(java.lang.Object key)
-
nonNullTableObjectEquals
private boolean nonNullTableObjectEquals(java.lang.Object cur, T key)
-
asParallel
public ParallelUnsortedSetIterable<T> asParallel(java.util.concurrent.ExecutorService executorService, int batchSize)
Description copied from interface:SetIterable
Returns a parallel iterable of this SetIterable.- Specified by:
asParallel
in interfaceSetIterable<T>
- Specified by:
asParallel
in interfaceUnsortedSetIterable<T>
-
-