Class TripletonSet<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>
org.eclipse.collections.impl.set.fixed.TripletonSet<T>
- All Implemented Interfaces:
Externalizable
,Serializable
,Cloneable
,Iterable<T>
,Collection<T>
,Set<T>
,FixedSizeCollection<T>
,MutableCollection<T>
,InternalIterable<T>
,RichIterable<T>
,FixedSizeSet<T>
,MutableSet<T>
,MutableSetIterable<T>
,SetIterable<T>
,UnsortedSetIterable<T>
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.eclipse.collections.impl.set.fixed.AbstractMemoryEfficientMutableSet
AbstractMemoryEfficientMutableSet.MemoryEfficientSetIterator
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
boolean
Returns true if the iterable has an element which responds true to element.equals(object).void
The procedure is executed for each element in the iterable.boolean
Follows the same general contract asSet.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.getFirst()
Returns the first element of an iterable.getLast()
Returns the last element of an iterable.getOnly()
Returns the element if the iterable has exactly one element.(package private) T
int
hashCode()
Follows the same general contract asSet.hashCode()
.iterator()
void
int
size()
Returns the number of items in this iterable.This method allows mutable and fixed size collections the ability to add elements to their existing elements.This method allows mutable and fixed size collections the ability to remove elements from their existing elements.void
Methods inherited from class org.eclipse.collections.impl.set.fixed.AbstractMemoryEfficientMutableSet
addAll, addAllIterable, asParallel, clear, nullSafeHashCode, remove, removeAll, removeAllIterable, removeIf, removeIfWith, retainAll, retainAllIterable, tap, withAll, withoutAll
Methods inherited from class org.eclipse.collections.impl.set.mutable.AbstractMutableSet
asSynchronized, asUnmodifiable, cartesianProduct, 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, containsAll, containsAllArguments, containsAllIterable, count, countWith, detect, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, forEach, 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
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods inherited from interface org.eclipse.collections.api.collection.FixedSizeCollection
add
Methods inherited from interface org.eclipse.collections.api.InternalIterable
forEach
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, 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, containsAll, containsAllArguments, containsAllIterable, containsAny, containsAnyIterable, containsBy, containsNone, containsNoneIterable, count, countBy, countByEach, countByWith, countWith, detect, detectIfNone, detectOptional, detectWith, detectWithIfNone, detectWithOptional, flatCollect, flatCollectBoolean, flatCollectByte, flatCollectChar, flatCollectDouble, flatCollectFloat, flatCollectInt, flatCollectLong, flatCollectShort, flatCollectWith, forEach, getAny, 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, 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, containsAll, isEmpty, spliterator, toArray, toArray
Methods inherited from interface org.eclipse.collections.api.set.SetIterable
cartesianProduct, differenceInto, intersectInto, isProperSubsetOf, isSubsetOf, symmetricDifferenceInto, unionInto
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
element1
-
element2
-
element3
-
-
Constructor Details
-
TripletonSet
public TripletonSet() -
TripletonSet
-
-
Method Details
-
size
public int size()Description copied from interface:RichIterable
Returns the number of items in this iterable.- Specified by:
size
in interfaceCollection<T>
- Specified by:
size
in interfaceRichIterable<T>
- Specified by:
size
in interfaceSet<T>
-
equals
Description copied from interface:SetIterable
Follows the same general contract asSet.equals(Object)
. -
hashCode
public int hashCode()Description copied from interface:SetIterable
Follows the same general contract asSet.hashCode()
. -
clone
- Specified by:
clone
in interfaceMutableSet<T>
- Overrides:
clone
in classAbstractMutableSet<T>
-
contains
Description copied from interface:RichIterable
Returns true if the iterable has an element which responds true to element.equals(object).- Specified by:
contains
in interfaceCollection<T>
- Specified by:
contains
in interfaceRichIterable<T>
- Specified by:
contains
in interfaceSet<T>
- Overrides:
contains
in classAbstractRichIterable<T>
-
iterator
-
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>
-
getSecond
T getSecond() -
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>
-
getOnly
Description copied from interface:RichIterable
Returns the element if the iterable has exactly one element. Otherwise, throwIllegalStateException
.- Specified by:
getOnly
in interfaceRichIterable<T>
- Returns:
- an element of an iterable.
-
each
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:
-
forEachWithIndex
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>
-
forEachWith
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>
-
writeExternal
- Specified by:
writeExternal
in interfaceExternalizable
- Throws:
IOException
-
readExternal
- Specified by:
readExternal
in interfaceExternalizable
- Throws:
IOException
ClassNotFoundException
-
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 interfaceFixedSizeSet<T>
- Specified by:
with
in interfaceMutableCollection<T>
- Specified by:
with
in interfaceMutableSet<T>
- Specified by:
with
in interfaceMutableSetIterable<T>
- See Also:
-
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 interfaceFixedSizeSet<T>
- Specified by:
without
in interfaceMutableCollection<T>
- Specified by:
without
in interfaceMutableSet<T>
- Specified by:
without
in interfaceMutableSetIterable<T>
- See Also:
-