Externalizable
, Serializable
, Cloneable
, Iterable<T>
, Collection<T>
, 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 Externalizable
Constructor | Description |
---|---|
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(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,
Collection<? extends T> collection) |
|
UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy,
UnifiedSetWithHashingStrategy<T> set) |
Modifier and Type | Method | Description |
---|---|---|
boolean |
add(T key) |
|
boolean |
addAllIterable(Iterable<? extends T> iterable) |
|
T |
addOrReplace(T key) |
|
ParallelUnsortedSetIterable<T> |
asParallel(ExecutorService executorService,
int batchSize) |
Returns a parallel iterable of this SetIterable.
|
void |
batchForEach(Procedure<? super T> procedure,
int sectionIndex,
int sectionCount) |
|
void |
clear() |
|
UnifiedSetWithHashingStrategy<T> |
clone() |
|
boolean |
contains(Object key) |
Returns true if the iterable has an element which responds true to element.equals(object).
|
void |
each(Procedure<? super T> procedure) |
The procedure is executed for each element in the iterable.
|
boolean |
equals(Object object) |
Follows the same general contract as
Set.equals(Object) . |
<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 to
key . |
T |
getFirst() |
Returns the first element of an iterable.
|
T |
getLast() |
Returns the last element of an iterable.
|
<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 Iterable<V>> function) |
Similar to
RichIterable.groupBy(Function) , except the result of evaluating function will return a collection of keys
for each value. |
int |
hashCode() |
Follows the same general contract as
Set.hashCode() . |
HashingStrategy<? super T> |
hashingStrategy() |
|
Iterator<T> |
iterator() |
|
<V> LazyIterable<V> |
lazyCollect(Function<? super T,? extends V> function) |
Deprecated.
since 3.0. Use
AbstractRichIterable.asLazy() .AbstractUnifiedSet.collect(Function) instead. |
LazyIterable<T> |
lazyReject(Predicate<? super T> predicate) |
Deprecated.
since 3.0. Use
AbstractRichIterable.asLazy() .reject(Predicate) instead. |
LazyIterable<T> |
lazySelect(Predicate<? super T> predicate) |
Deprecated.
since 3.0. Use
AbstractRichIterable.asLazy() .select(Predicate) instead. |
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,
Iterable<? extends K> source) |
|
static <K> UnifiedSetWithHashingStrategy<K> |
newSet(UnifiedSetWithHashingStrategy<K> set) |
|
static <K> UnifiedSetWithHashingStrategy<K> |
newSetWith(HashingStrategy<? super K> hashingStrategy,
K... elements) |
|
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) |
Puts
key into the pool. |
void |
readExternal(ObjectInput in) |
|
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 to
RichIterable.reject(Predicate) , except with an evaluation parameter for the second generic argument in Predicate2 . |
boolean |
remove(Object key) |
|
T |
removeFromPool(T key) |
Locates an object in the pool which is equal to
key and removes it. |
boolean |
retainAllIterable(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(Class<S> clazz) |
Returns all elements of the source collection that are instances of the Class
clazz . |
<P> UnifiedSetWithHashingStrategy<T> |
selectWith(Predicate2<? super T,? super P> predicate,
P parameter) |
Similar to
RichIterable.select(Predicate) , except with an evaluation parameter for the second generic argument in Predicate2 . |
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 returns
this . |
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.
|
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(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(Iterable<? extends T> elements) |
This method allows mutable and fixed size collections the ability to remove multiple elements from their existing
elements.
|
void |
writeExternal(ObjectOutput out) |
addAll, aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, reduce, removeAll, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong
appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, 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
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, asSynchronized, asUnmodifiable, cartesianProduct, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, detect, detectOptional, difference, differenceInto, flatCollect, getBatchCount, groupByUniqueKey, injectIntoWith, intersect, intersectInto, isProperSubsetOf, isSubsetOf, noneSatisfy, noneSatisfyWith, powerSet, removeAllIterable, retainAll, symmetricDifference, symmetricDifferenceInto, union, unionInto, zip, zipWithIndex
forEach
parallelStream, removeIf, stream
forEach
aggregateBy, aggregateInPlaceBy, countBy, countByEach, countByWith, removeIf, removeIfWith, sumByDouble, sumByFloat, sumByInt, sumByLong
flatCollectWith
appendString, appendString, appendString, asLazy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, containsAll, containsAllArguments, containsAllIterable, count, countBy, countByEach, countByWith, countWith, detectIfNone, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectWith, forEach, getAny, getOnly, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, 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, toList, toMap, toMap, toSet, toSortedBag, toSortedBag, toSortedBagBy, toSortedList, toSortedList, toSortedListBy, toSortedMap, toSortedMap, toSortedMapBy, toSortedSet, toSortedSet, toSortedSetBy, toString, zip, zipWithIndex
@Deprecated public UnifiedSetWithHashingStrategy()
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 UnifiedSetWithHashingStrategy(HashingStrategy<? super T> hashingStrategy, UnifiedSetWithHashingStrategy<T> set)
public static <K> UnifiedSetWithHashingStrategy<K> newSet(HashingStrategy<? super K> hashingStrategy)
public static <K> UnifiedSetWithHashingStrategy<K> newSet(UnifiedSetWithHashingStrategy<K> set)
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)
public HashingStrategy<? super T> hashingStrategy()
public void clear()
public boolean add(T key)
add
in interface Collection<T>
add
in interface Set<T>
add
in class AbstractMutableCollection<T>
public boolean contains(Object key)
RichIterable
contains
in interface Collection<T>
contains
in interface RichIterable<T>
contains
in interface Set<T>
contains
in class AbstractRichIterable<T>
public void batchForEach(Procedure<? super T> procedure, int sectionIndex, int sectionCount)
batchForEach
in interface BatchIterable<T>
public UnifiedSetWithHashingStrategy<T> tap(Procedure<? super T> procedure)
RichIterable
this
.
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()); } });
tap
in interface MutableCollection<T>
tap
in interface MutableSet<T>
tap
in interface MutableSetIterable<T>
tap
in interface RichIterable<T>
tap
in interface SetIterable<T>
tap
in interface UnsortedSetIterable<T>
RichIterable.each(Procedure)
,
RichIterable.forEach(Procedure)
public void each(Procedure<? super T> procedure)
RichIterable
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 of
InternalIterable.forEach(Procedure)
that has a signature conflict with Iterable.forEach(java.util.function.Consumer)
.each
in interface RichIterable<T>
InternalIterable.forEach(Procedure)
,
Iterable.forEach(java.util.function.Consumer)
public <P> void forEachWith(Procedure2<? super T,? super P> procedure, P parameter)
InternalIterable
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);
forEachWith
in interface InternalIterable<T>
forEachWith
in class AbstractRichIterable<T>
public void forEachWithIndex(ObjectIntProcedure<? super T> objectIntProcedure)
InternalIterable
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()); } });
forEachWithIndex
in interface InternalIterable<T>
forEachWithIndex
in class AbstractRichIterable<T>
public UnifiedSetWithHashingStrategy<T> newEmpty()
MutableCollection
newEmpty
in interface MutableCollection<T>
newEmpty
in interface MutableSet<T>
public UnifiedSetWithHashingStrategy<T> newEmpty(int size)
newEmpty
in class AbstractUnifiedSet<T>
public T getFirst()
RichIterable
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.
getFirst
in interface RichIterable<T>
public T getLast()
RichIterable
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.
getLast
in interface RichIterable<T>
public UnifiedSetWithHashingStrategy<T> select(Predicate<? super T> predicate)
RichIterable
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"); } });
select
in interface MutableCollection<T>
select
in interface MutableSet<T>
select
in interface MutableSetIterable<T>
select
in interface RichIterable<T>
select
in interface SetIterable<T>
select
in interface UnsortedSetIterable<T>
public <P> UnifiedSetWithHashingStrategy<T> selectWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterable
RichIterable.select(Predicate)
, except with an evaluation parameter for the second generic argument in Predicate2
.
E.g. return a Collection
of Person elements where the person has an age greater than or equal to 18 years
Example 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));
selectWith
in interface MutableCollection<T>
selectWith
in interface MutableSet<T>
selectWith
in interface MutableSetIterable<T>
selectWith
in interface RichIterable<T>
selectWith
in interface SetIterable<T>
selectWith
in interface UnsortedSetIterable<T>
predicate
- a Predicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argument P
in predicate
RichIterable.select(Predicate)
public UnifiedSetWithHashingStrategy<T> reject(Predicate<? super T> predicate)
RichIterable
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"); } });
reject
in interface MutableCollection<T>
reject
in interface MutableSet<T>
reject
in interface MutableSetIterable<T>
reject
in interface RichIterable<T>
reject
in interface SetIterable<T>
reject
in interface UnsortedSetIterable<T>
predicate
- a Predicate
to use as the reject criteriaPredicate.accept(Object)
method to evaluate to falsepublic <P> UnifiedSetWithHashingStrategy<T> rejectWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterable
RichIterable.reject(Predicate)
, except with an evaluation parameter for the second generic argument in Predicate2
.
E.g. return a Collection
of Person elements where the person has an age greater than or equal to 18 years
Example 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));
rejectWith
in interface MutableCollection<T>
rejectWith
in interface MutableSet<T>
rejectWith
in interface MutableSetIterable<T>
rejectWith
in interface RichIterable<T>
rejectWith
in interface SetIterable<T>
rejectWith
in interface UnsortedSetIterable<T>
predicate
- a Predicate2
to use as the select criteriaparameter
- a parameter to pass in for evaluation of the second argument P
in predicate
RichIterable.select(Predicate)
public <P> Twin<MutableList<T>> selectAndRejectWith(Predicate2<? super T,? super P> predicate, P parameter)
MutableCollection
e.g. return lastNames.selectAndRejectWith(Predicates2.lessThan(), "Mason");
selectAndRejectWith
in interface MutableCollection<T>
selectAndRejectWith
in class AbstractMutableCollection<T>
public PartitionMutableSet<T> partition(Predicate<? super T> predicate)
RichIterable
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"); } });
partition
in interface MutableCollection<T>
partition
in interface MutableSet<T>
partition
in interface MutableSetIterable<T>
partition
in interface RichIterable<T>
partition
in interface SetIterable<T>
public <P> PartitionMutableSet<T> partitionWith(Predicate2<? super T,? super P> predicate, P parameter)
RichIterable
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");
partitionWith
in interface MutableCollection<T>
partitionWith
in interface MutableSet<T>
partitionWith
in interface MutableSetIterable<T>
partitionWith
in interface RichIterable<T>
partitionWith
in interface SetIterable<T>
public <S> UnifiedSetWithHashingStrategy<S> selectInstancesOf(Class<S> clazz)
RichIterable
clazz
.
RichIterable<Integer> integers = List.mutable.with(new Integer(0), new Long(0L), new Double(0.0)).selectInstancesOf(Integer.class);
selectInstancesOf
in interface MutableCollection<T>
selectInstancesOf
in interface MutableSet<T>
selectInstancesOf
in interface MutableSetIterable<T>
selectInstancesOf
in interface RichIterable<T>
selectInstancesOf
in interface SetIterable<T>
selectInstancesOf
in interface UnsortedSetIterable<T>
@Deprecated public LazyIterable<T> lazySelect(Predicate<? super T> predicate)
AbstractRichIterable.asLazy()
.select(Predicate)
instead.@Deprecated public LazyIterable<T> lazyReject(Predicate<? super T> predicate)
AbstractRichIterable.asLazy()
.reject(Predicate)
instead.@Deprecated public <V> LazyIterable<V> lazyCollect(Function<? super T,? extends V> function)
AbstractRichIterable.asLazy()
.AbstractUnifiedSet.collect(Function)
instead.public ImmutableSet<T> toImmutable()
MutableSet
toImmutable
in interface MutableCollection<T>
toImmutable
in interface MutableSet<T>
toImmutable
in interface SetIterable<T>
toImmutable
in interface UnsortedSetIterable<T>
public UnifiedSetWithHashingStrategy<T> with(T element)
MutableCollection
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.with
in interface MutableCollection<T>
with
in interface MutableSet<T>
Collection.add(Object)
public UnifiedSetWithHashingStrategy<T> with(T element1, T element2)
public UnifiedSetWithHashingStrategy<T> with(T element1, T element2, T element3)
public UnifiedSetWithHashingStrategy<T> with(T... elements)
public UnifiedSetWithHashingStrategy<T> withAll(Iterable<? extends T> iterable)
MutableCollection
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.withAll
in interface MutableCollection<T>
withAll
in interface MutableSet<T>
Collection.addAll(Collection)
public UnifiedSetWithHashingStrategy<T> without(T element)
MutableCollection
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.without
in interface MutableCollection<T>
without
in interface MutableSet<T>
Collection.remove(Object)
public UnifiedSetWithHashingStrategy<T> withoutAll(Iterable<? extends T> elements)
MutableCollection
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.withoutAll
in interface MutableCollection<T>
withoutAll
in interface MutableSet<T>
Collection.removeAll(Collection)
public boolean addAllIterable(Iterable<? extends T> iterable)
addAllIterable
in interface MutableCollection<T>
addAllIterable
in class AbstractMutableCollection<T>
Collection.addAll(Collection)
public boolean remove(Object key)
remove
in interface Collection<T>
remove
in interface Set<T>
remove
in class AbstractMutableCollection<T>
public int size()
RichIterable
size
in interface BatchIterable<T>
size
in interface Collection<T>
size
in interface Pool<T>
size
in interface RichIterable<T>
size
in interface Set<T>
public boolean equals(Object object)
SetIterable
Set.equals(Object)
.public int hashCode()
SetIterable
Set.hashCode()
.public boolean trimToSize()
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public boolean retainAllIterable(Iterable<?> iterable)
retainAllIterable
in interface MutableCollection<T>
retainAllIterable
in class AbstractMutableCollection<T>
Collection.retainAll(Collection)
public UnifiedSetWithHashingStrategy<T> clone()
clone
in interface MutableSet<T>
clone
in class AbstractUnifiedSet<T>
public Object[] toArray()
RichIterable
toArray
in interface Collection<T>
toArray
in interface RichIterable<T>
toArray
in interface Set<T>
toArray
in class AbstractRichIterable<T>
Collection.toArray()
public <T> T[] toArray(T[] array)
RichIterable
toArray
in interface Collection<T>
toArray
in interface RichIterable<T>
toArray
in interface Set<T>
toArray
in class AbstractRichIterable<T>
Collection.toArray(Object[])
public <V> UnifiedSetWithHashingStrategyMultimap<V,T> groupBy(Function<? super T,? extends V> function)
RichIterable
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(); } });
groupBy
in interface MutableCollection<T>
groupBy
in interface MutableSet<T>
groupBy
in interface MutableSetIterable<T>
groupBy
in interface RichIterable<T>
groupBy
in interface UnsortedSetIterable<T>
public <V> UnifiedSetWithHashingStrategyMultimap<V,T> groupByEach(Function<? super T,? extends Iterable<V>> function)
RichIterable
RichIterable.groupBy(Function)
, except the result of evaluating function will return a collection of keys
for each value.groupByEach
in interface MutableCollection<T>
groupByEach
in interface MutableSet<T>
groupByEach
in interface MutableSetIterable<T>
groupByEach
in interface RichIterable<T>
groupByEach
in interface UnsortedSetIterable<T>
public T get(T key)
Pool
key
.public T put(T key)
Pool
key
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 to key
, the pool will remain unchanged
and the pooled instance will be is returned.public T removeFromPool(T key)
Pool
key
and removes it.removeFromPool
in interface Pool<T>
key
- object to removepublic ParallelUnsortedSetIterable<T> asParallel(ExecutorService executorService, int batchSize)
SetIterable
asParallel
in interface SetIterable<T>
asParallel
in interface UnsortedSetIterable<T>
Copyright © 2004–2019. All rights reserved.