Class AbstractSetUsingMap<T>
java.lang.Object
org.javimmutable.collections.common.AbstractSet<T>
org.javimmutable.collections.common.AbstractSetUsingMap<T>
- All Implemented Interfaces:
Serializable
,Iterable<T>
,ICollection<T>
,InvariantCheckable
,ISet<T>
,IStreamable<T>
,Mapped<T,
,T> SplitableIterable<T>
- Direct Known Subclasses:
OrderedSet
,TreeSet
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks invariants of implementing class.protected void
boolean
Determines if the Set contains the specified value.Implemented by derived classes to create a new instance of the appropriate class.Removes the value from the Set.Removes all values of other from the Set.int
Adds the single value to the Set.intersection
(Iterator<? extends T> values) Removes all values from the Set that are not contained in the other collection.intersection
(Set<? extends T> other) Removes all values from the Set that are not contained in the other collection.boolean
isEmpty()
iterator()
Overridden here to require implementations to return a SplitableIterator rather than a basic Iterator.int
size()
Adds all values from other to the Set.Methods inherited from class org.javimmutable.collections.common.AbstractSet
containsAll, containsAll, containsAny, containsAny, deleteAll, emptyMutableSet, equals, getSet, hashCode, insertAll, insertAll, intersection, intersection, toString, union
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.javimmutable.collections.ICollection
isNonEmpty
Methods inherited from interface org.javimmutable.collections.ISet
deleteAll, find, get, getValueOr, reject, select, setCollector
Methods inherited from interface org.javimmutable.collections.IStreamable
parallelStream, spliterator, stream
Methods inherited from interface org.javimmutable.collections.SplitableIterable
forEachThrows, indexedForEach, indexedForEachThrows, reduce, reduceThrows
-
Field Details
-
map
-
-
Constructor Details
-
AbstractSetUsingMap
-
-
Method Details
-
insert
Description copied from interface:ISet
Adds the single value to the Set.- Returns:
- instance of set containing the value
-
contains
Description copied from interface:ISet
Determines if the Set contains the specified value.- Returns:
- true if the Set contains the value
-
delete
Description copied from interface:ISet
Removes the value from the Set. Has no effect if the value is not in the Set.- Returns:
- instance of set without the value
-
deleteAll
Description copied from interface:ISet
Removes all values of other from the Set. Has no effect if none of the values are in the Set- Returns:
- instance of set without the values
-
union
Description copied from interface:ISet
Adds all values from other to the Set.- Parameters:
values
- source of values to add- Returns:
- instance of set containing the values
-
intersection
Description copied from interface:ISet
Removes all values from the Set that are not contained in the other collection.- Returns:
- instance of set with unmatched values removed
-
intersection
Description copied from interface:ISet
Removes all values from the Set that are not contained in the other collection.- Returns:
- instance of set with unmatched values removed
-
size
public int size()- Returns:
- number of values in the collection
-
isEmpty
public boolean isEmpty()- Returns:
- true only if collection contains no values
-
iterator
Description copied from interface:IStreamable
Overridden here to require implementations to return a SplitableIterator rather than a basic Iterator. This is necessary to allow composition of new objects from methods like keys() and values(). -
getSpliteratorCharacteristics
public int getSpliteratorCharacteristics()- Returns:
- characteristics value used when creating Spliterators
-
checkInvariants
public void checkInvariants()Description copied from interface:InvariantCheckable
Checks invariants of implementing class. -
checkSetInvariants
protected void checkSetInvariants() -
create
Implemented by derived classes to create a new instance of the appropriate class.
-