Class AbstractMemoryEfficientMutableSet<T>
- java.lang.Object
-
- org.eclipse.collections.impl.AbstractRichIterable<T>
-
- org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection<T>
-
- org.eclipse.collections.impl.set.mutable.AbstractMutableSet<T>
-
- org.eclipse.collections.impl.set.fixed.AbstractMemoryEfficientMutableSet<T>
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.lang.Iterable<T>
,java.util.Collection<T>
,java.util.Set<T>
,FixedSizeCollection<T>
,MutableCollection<T>
,InternalIterable<T>
,RichIterable<T>
,FixedSizeSet<T>
,MutableSet<T>
,MutableSetIterable<T>
,SetIterable<T>
,UnsortedSetIterable<T>
- Direct Known Subclasses:
DoubletonSet
,EmptySet
,QuadrupletonSet
,SingletonSet
,TripletonSet
abstract class AbstractMemoryEfficientMutableSet<T> extends AbstractMutableSet<T> implements FixedSizeSet<T>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractMemoryEfficientMutableSet.MemoryEfficientSetIterator
-
Constructor Summary
Constructors Constructor Description AbstractMemoryEfficientMutableSet()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addAll(java.util.Collection<? extends T> collection)
boolean
addAllIterable(java.lang.Iterable<? extends T> iterable)
ParallelUnsortedSetIterable<T>
asParallel(java.util.concurrent.ExecutorService executorService, int batchSize)
Returns a parallel iterable of this SetIterable.void
clear()
protected int
nullSafeHashCode(java.lang.Object element)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> collection)
boolean
removeAllIterable(java.lang.Iterable<?> iterable)
boolean
removeIf(Predicate<? super T> predicate)
Removes all elements in the collection that evaluate to true for the specified predicate.<P> boolean
removeIfWith(Predicate2<? super T,? super P> predicate, P parameter)
Removes all elements in the collection that evaluate to true for the specified predicate2 and parameter.boolean
retainAll(java.util.Collection<?> collection)
boolean
retainAllIterable(java.lang.Iterable<?> iterable)
FixedSizeSet<T>
tap(Procedure<? super T> procedure)
Executes the Procedure for each element in the iterable and returnsthis
.MutableSet<T>
withAll(java.lang.Iterable<? extends T> elements)
This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.MutableSet<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.-
Methods inherited from class org.eclipse.collections.impl.set.mutable.AbstractMutableSet
asSynchronized, asUnmodifiable, cartesianProduct, clone, collect, collectIf, collectWith, difference, differenceInto, flatCollect, groupBy, groupByEach, intersect, intersectInto, isProperSubsetOf, isSubsetOf, newEmpty, newEmptySameSize, partition, partitionWith, powerSet, reject, rejectWith, select, selectInstancesOf, selectWith, symmetricDifference, symmetricDifferenceInto, toImmutable, union, unionInto, zip, zipWithIndex
-
Methods inherited from class org.eclipse.collections.impl.collection.mutable.AbstractMutableCollection
add, chunk, countBy, countByEach, countByWith, groupByUniqueKey, injectIntoWith, reduce, selectAndRejectWith, sumByDouble, sumByFloat, sumByInt, sumByLong
-
Methods inherited from class org.eclipse.collections.impl.AbstractRichIterable
allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, asLazy, collect, collectIf, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, forEachWith, forEachWithIndex, groupBy, groupByEach, groupByUniqueKey, injectInto, injectInto, injectInto, injectInto, injectInto, into, isEmpty, max, max, maxBy, min, min, minBy, noneSatisfy, noneSatisfyWith, reject, rejectWith, select, selectWith, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.collections.api.collection.FixedSizeCollection
add
-
Methods inherited from interface org.eclipse.collections.api.set.FixedSizeSet
with, without
-
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach, forEachWith, forEachWithIndex
-
Methods inherited from interface org.eclipse.collections.api.collection.MutableCollection
aggregateBy, aggregateInPlaceBy, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, countBy, countByEach, countByWith, flatCollect, flatCollectWith, groupByUniqueKey, injectIntoWith, partition, partitionWith, reject, rejectWith, select, selectAndRejectWith, selectInstancesOf, selectWith, sumByDouble, sumByFloat, sumByInt, sumByLong, toImmutable, zipWithIndex
-
Methods inherited from interface org.eclipse.collections.api.set.MutableSet
asSynchronized, asUnmodifiable, clone, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, difference, flatCollect, flatCollectWith, groupBy, groupByEach, intersect, newEmpty, partition, partitionWith, powerSet, reject, rejectWith, select, selectInstancesOf, selectWith, symmetricDifference, toImmutable, toImmutableSet, union, zip, zipWithIndex
-
Methods inherited from interface org.eclipse.collections.api.RichIterable
aggregateBy, allSatisfy, allSatisfyWith, anySatisfy, anySatisfyWith, appendString, appendString, appendString, asLazy, chunk, collect, collectBoolean, collectByte, collectChar, collectDouble, collectFloat, collectIf, collectInt, collectLong, collectShort, collectWith, contains, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, each, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, getFirst, getLast, 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, noneSatisfy, noneSatisfyWith, notEmpty, reduce, reduceInPlace, reduceInPlace, reject, rejectWith, select, selectWith, size, summarizeDouble, summarizeFloat, summarizeInt, summarizeLong, sumOfDouble, sumOfFloat, sumOfInt, sumOfLong, toArray, toArray, 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
-
Methods inherited from interface java.util.Set
add, contains, containsAll, equals, hashCode, isEmpty, iterator, size, spliterator, toArray, toArray
-
Methods inherited from interface org.eclipse.collections.api.set.SetIterable
cartesianProduct, differenceInto, equals, hashCode, intersectInto, isProperSubsetOf, isSubsetOf, symmetricDifferenceInto, unionInto
-
-
-
-
Method Detail
-
nullSafeHashCode
protected int nullSafeHashCode(java.lang.Object element)
-
addAll
public boolean addAll(java.util.Collection<? extends T> collection)
- Specified by:
addAll
in interfacejava.util.Collection<T>
- Specified by:
addAll
in interfaceFixedSizeCollection<T>
- Specified by:
addAll
in interfacejava.util.Set<T>
- Overrides:
addAll
in classAbstractMutableCollection<T>
-
addAllIterable
public boolean addAllIterable(java.lang.Iterable<? extends T> iterable)
- Specified by:
addAllIterable
in interfaceFixedSizeCollection<T>
- Specified by:
addAllIterable
in interfaceMutableCollection<T>
- Overrides:
addAllIterable
in classAbstractMutableCollection<T>
- See Also:
Collection.addAll(Collection)
-
retainAll
public boolean retainAll(java.util.Collection<?> collection)
- Specified by:
retainAll
in interfacejava.util.Collection<T>
- Specified by:
retainAll
in interfaceFixedSizeCollection<T>
- Specified by:
retainAll
in interfacejava.util.Set<T>
- Overrides:
retainAll
in classAbstractMutableCollection<T>
-
retainAllIterable
public boolean retainAllIterable(java.lang.Iterable<?> iterable)
- Specified by:
retainAllIterable
in interfaceFixedSizeCollection<T>
- Specified by:
retainAllIterable
in interfaceMutableCollection<T>
- Overrides:
retainAllIterable
in classAbstractMutableCollection<T>
- See Also:
Collection.retainAll(Collection)
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<T>
- Specified by:
remove
in interfaceFixedSizeCollection<T>
- Specified by:
remove
in interfacejava.util.Set<T>
- Overrides:
remove
in classAbstractMutableCollection<T>
-
removeAll
public boolean removeAll(java.util.Collection<?> collection)
- Specified by:
removeAll
in interfacejava.util.Collection<T>
- Specified by:
removeAll
in interfaceFixedSizeCollection<T>
- Specified by:
removeAll
in interfacejava.util.Set<T>
- Overrides:
removeAll
in classAbstractMutableCollection<T>
-
removeAllIterable
public boolean removeAllIterable(java.lang.Iterable<?> iterable)
- Specified by:
removeAllIterable
in interfaceFixedSizeCollection<T>
- Specified by:
removeAllIterable
in interfaceMutableCollection<T>
- Overrides:
removeAllIterable
in classAbstractMutableSet<T>
- See Also:
Collection.removeAll(Collection)
-
removeIf
public boolean removeIf(Predicate<? super T> predicate)
Description copied from interface:MutableCollection
Removes all elements in the collection that evaluate to true for the specified predicate.e.g. return lastNames.removeIf(Predicates.isNull());
- Specified by:
removeIf
in interfaceFixedSizeCollection<T>
- Specified by:
removeIf
in interfaceMutableCollection<T>
- Overrides:
removeIf
in classAbstractMutableCollection<T>
-
removeIfWith
public <P> boolean removeIfWith(Predicate2<? super T,? super P> predicate, P parameter)
Description copied from interface:MutableCollection
Removes all elements in the collection that evaluate to true for the specified predicate2 and parameter.return lastNames.removeIfWith(Predicates2.isNull(), null);
- Specified by:
removeIfWith
in interfaceFixedSizeCollection<T>
- Specified by:
removeIfWith
in interfaceMutableCollection<T>
- Overrides:
removeIfWith
in classAbstractMutableCollection<T>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<T>
- Specified by:
clear
in interfaceFixedSizeCollection<T>
- Specified by:
clear
in interfacejava.util.Set<T>
-
withAll
public MutableSet<T> withAll(java.lang.Iterable<? extends T> elements)
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 interfaceFixedSizeCollection<T>
- Specified by:
withAll
in interfaceFixedSizeSet<T>
- Specified by:
withAll
in interfaceMutableCollection<T>
- Specified by:
withAll
in interfaceMutableSet<T>
- Specified by:
withAll
in interfaceMutableSetIterable<T>
- See Also:
Collection.addAll(Collection)
-
withoutAll
public MutableSet<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 interfaceFixedSizeCollection<T>
- Specified by:
withoutAll
in interfaceFixedSizeSet<T>
- Specified by:
withoutAll
in interfaceMutableCollection<T>
- Specified by:
withoutAll
in interfaceMutableSet<T>
- Specified by:
withoutAll
in interfaceMutableSetIterable<T>
- See Also:
Collection.removeAll(Collection)
-
tap
public FixedSizeSet<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 interfaceFixedSizeCollection<T>
- Specified by:
tap
in interfaceFixedSizeSet<T>
- 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>
- Overrides:
tap
in classAbstractMutableSet<T>
- See Also:
RichIterable.each(Procedure)
,RichIterable.forEach(Procedure)
-
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>
-
-