Module org.jhotdraw8.icollection
Interface ImmutableNavigableSet<E>
- Type Parameters:
E- the element type
- All Superinterfaces:
ImmutableCollection<E>,ImmutableSet<E>,ImmutableSortedSet<E>,Iterable<E>,ReadOnlyCollection<E>,ReadOnlyNavigableSet<E>,ReadOnlySequencedCollection<E>,ReadOnlySequencedSet<E>,ReadOnlySet<E>,ReadOnlySortedSet<E>
- All Known Implementing Classes:
RedBlackSet
An interface to an immutable navigable set; the implementation guarantees that the state of the collection does not change.
-
Method Summary
Modifier and TypeMethodDescriptionReturns a copy of this set that contains all elements of this set and also the specified element.default @NonNull ImmutableNavigableSet<E> Returns a copy of this set that contains all elements of this set and also all elements of the specified collection.<T> @NonNull ImmutableNavigableSet<T> empty()Returns an empty set instance that has the specified element type.Returns a copy of this set that contains all elements of this set except the specified element.default @NonNull ImmutableNavigableSet<E> Returns a copy of this set that contains all elements of this set except the elements of the specified collection.default ImmutableNavigableSet<E> Returns a copy of this set that contains all elements of this set except the first.default ImmutableNavigableSet<E> Returns a copy of this set that contains all elements of this set except the last.default @NonNull ImmutableNavigableSet<E> Returns a copy of this set that contains only elements that are in this set and in the specified collection.default @NonNull ImmutableNavigableSet<E> reversed()Returns a mutable copy of this set.Methods inherited from interface org.jhotdraw8.icollection.immutable.ImmutableCollection
filter, maxSizeMethods inherited from interface org.jhotdraw8.icollection.immutable.ImmutableSortedSet
emptyMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlyCollection
contains, containsAll, isEmpty, iterator, size, stream, toArray, toArrayMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlyNavigableSet
ceiling, floor, higher, lowerMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlySequencedCollection
asCollection, getFirst, getLastMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlySequencedSet
asSet, readOnlyReversedMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlySet
characteristics, equals, hashCodeMethods inherited from interface org.jhotdraw8.icollection.readonly.ReadOnlySortedSet
comparator
-
Method Details
-
add
Description copied from interface:ImmutableSetReturns a copy of this set that contains all elements of this set and also the specified element.- Specified by:
addin interfaceImmutableCollection<E>- Specified by:
addin interfaceImmutableSet<E>- Specified by:
addin interfaceImmutableSortedSet<E>- Parameters:
element- an element- Returns:
- this set instance if it already contains the element, or a different set instance with the element added
-
addAll
Description copied from interface:ImmutableSetReturns a copy of this set that contains all elements of this set and also all elements of the specified collection.- Specified by:
addAllin interfaceImmutableCollection<E>- Specified by:
addAllin interfaceImmutableSet<E>- Specified by:
addAllin interfaceImmutableSortedSet<E>- Parameters:
c- a collection to be added to this set- Returns:
- this set instance if it already contains the elements, or a different set instance with the elements added
-
empty
Description copied from interface:ImmutableSetReturns an empty set instance that has the specified element type.- Specified by:
emptyin interfaceImmutableCollection<E>- Specified by:
emptyin interfaceImmutableSet<E>- Specified by:
emptyin interfaceImmutableSortedSet<E>- Type Parameters:
T- the element type of the returned set- Returns:
- an empty set of the specified element type.
-
remove
Description copied from interface:ImmutableSetReturns a copy of this set that contains all elements of this set except the specified element.- Specified by:
removein interfaceImmutableCollection<E>- Specified by:
removein interfaceImmutableSet<E>- Specified by:
removein interfaceImmutableSortedSet<E>- Parameters:
element- an element- Returns:
- this set instance if it already does not contain the element, or a different set instance with the element removed
-
removeAll
Description copied from interface:ImmutableSetReturns a copy of this set that contains all elements of this set except the elements of the specified collection.- Specified by:
removeAllin interfaceImmutableCollection<E>- Specified by:
removeAllin interfaceImmutableSet<E>- Specified by:
removeAllin interfaceImmutableSortedSet<E>- Parameters:
c- a collection with elements to be removed from this set- Returns:
- this set instance if it already does not contain the elements, or a different set instance with the elements removed
-
removeFirst
Returns a copy of this set that contains all elements of this set except the first.- Specified by:
removeFirstin interfaceImmutableSortedSet<E>- Returns:
- a new set instance with the first element removed
- Throws:
NoSuchElementException- if this set is empty
-
removeLast
Returns a copy of this set that contains all elements of this set except the last.- Specified by:
removeLastin interfaceImmutableSortedSet<E>- Returns:
- a new set instance with the last element removed
- Throws:
NoSuchElementException- if this set is empty
-
retainAll
Description copied from interface:ImmutableSetReturns a copy of this set that contains only elements that are in this set and in the specified collection.- Specified by:
retainAllin interfaceImmutableCollection<E>- Specified by:
retainAllin interfaceImmutableSet<E>- Specified by:
retainAllin interfaceImmutableSortedSet<E>- Parameters:
c- a collection with elements to be retained in this set- Returns:
- this set instance if it has not changed, or a different set instance with elements removed
-
toMutable
@NonNull NavigableSet<E> toMutable()Description copied from interface:ImmutableSetReturns a mutable copy of this set.- Specified by:
toMutablein interfaceImmutableCollection<E>- Specified by:
toMutablein interfaceImmutableSet<E>- Specified by:
toMutablein interfaceImmutableSortedSet<E>- Returns:
- a mutable copy.
-
reversed
- Specified by:
reversedin interfaceImmutableSortedSet<E>
-