Package org.eclipse.collections.api.set
Interface FixedSizeSet<T>
- All Superinterfaces:
Cloneable
,Collection<T>
,FixedSizeCollection<T>
,InternalIterable<T>
,Iterable<T>
,MutableCollection<T>
,MutableSet<T>
,MutableSetIterable<T>
,RichIterable<T>
,Set<T>
,SetIterable<T>
,UnsortedSetIterable<T>
public interface FixedSizeSet<T> extends MutableSet<T>, FixedSizeCollection<T>
A FixedSizeSet is a set that may be mutated, but cannot grow or shrink in size.
-
Method Summary
Modifier and Type Method Description FixedSizeSet<T>
tap(Procedure<? super T> procedure)
Executes the Procedure for each element in the iterable and returnsthis
.MutableSet<T>
with(T element)
This method allows mutable and fixed size collections the ability to add elements to their existing elements.MutableSet<T>
withAll(Iterable<? extends T> elements)
This method allows mutable and fixed size collections the ability to add multiple elements to their existing elements.MutableSet<T>
without(T element)
This method allows mutable and fixed size collections the ability to remove elements from their existing elements.MutableSet<T>
withoutAll(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 interface org.eclipse.collections.api.collection.FixedSizeCollection
add, addAll, addAllIterable, clear, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable
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, 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, containsBy, 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, into, isEmpty, 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, 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, addAll, clear, contains, containsAll, equals, hashCode, isEmpty, iterator, remove, removeAll, retainAll, size, spliterator, toArray, toArray
Methods inherited from interface org.eclipse.collections.api.set.SetIterable
cartesianProduct, differenceInto, equals, hashCode, intersectInto, isProperSubsetOf, isSubsetOf, symmetricDifferenceInto, unionInto
-
Method Details
-
with
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 interfaceFixedSizeCollection<T>
- Specified by:
with
in interfaceMutableCollection<T>
- Specified by:
with
in interfaceMutableSet<T>
- Specified by:
with
in interfaceMutableSetIterable<T>
- See Also:
Collection.add(Object)
-
without
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 interfaceFixedSizeCollection<T>
- Specified by:
without
in interfaceMutableCollection<T>
- Specified by:
without
in interfaceMutableSet<T>
- Specified by:
without
in interfaceMutableSetIterable<T>
- See Also:
Collection.remove(Object)
-
withAll
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 interfaceMutableCollection<T>
- Specified by:
withAll
in interfaceMutableSet<T>
- Specified by:
withAll
in interfaceMutableSetIterable<T>
- See Also:
Collection.addAll(Collection)
-
withoutAll
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 interfaceMutableCollection<T>
- Specified by:
withoutAll
in interfaceMutableSet<T>
- Specified by:
withoutAll
in interfaceMutableSetIterable<T>
- See Also:
Collection.removeAll(Collection)
-
tap
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 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)
-