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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks invariants of implementing class.protected voidbooleanDetermines 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.intAdds 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.booleanisEmpty()iterator()Overridden here to require implementations to return a SplitableIterator rather than a basic Iterator.intsize()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, unionMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.javimmutable.collections.ICollection
isNonEmptyMethods inherited from interface org.javimmutable.collections.ISet
deleteAll, find, get, getValueOr, reject, select, setCollectorMethods inherited from interface org.javimmutable.collections.IStreamable
parallelStream, spliterator, streamMethods 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:ISetAdds the single value to the Set.- Returns:
- instance of set containing the value
-
contains
Description copied from interface:ISetDetermines if the Set contains the specified value.- Returns:
- true if the Set contains the value
-
delete
Description copied from interface:ISetRemoves 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:ISetRemoves 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:ISetAdds 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:ISetRemoves 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:ISetRemoves 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:IStreamableOverridden 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:InvariantCheckableChecks invariants of implementing class. -
checkSetInvariants
protected void checkSetInvariants() -
create
Implemented by derived classes to create a new instance of the appropriate class.
-