Package org.organicdesign.fp.collections
Interface ImSortedSet<E>
-
- All Superinterfaces:
BaseSet<E>
,Collection<E>
,Iterable<E>
,Set<E>
,Sized
,SortedSet<E>
,Transformable<E>
,UnmodCollection<E>
,UnmodIterable<E>
,UnmodSet<E>
,UnmodSortedCollection<E>
,UnmodSortedIterable<E>
,UnmodSortedSet<E>
- All Known Implementing Classes:
PersistentTreeSet
public interface ImSortedSet<E> extends BaseSet<E>, UnmodSortedSet<E>
An immutable sorted set interface
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.organicdesign.fp.collections.UnmodIterable
UnmodIterable.UnIterable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default @NotNull ImSortedSet<E>
headSet(E toElement)
@NotNull UnmodSortedIterator<E>
iterator()
Iterates over contents in a guaranteed order.@NotNull ImSortedSet<E>
put(E e)
Adds an element.@NotNull ImSortedSet<E>
subSet(E fromElement, E toElement)
Return the elements in this set from the start element (inclusive) to the end element (exclusive)@NotNull ImSortedSet<E>
tailSet(E fromElement)
default @NotNull ImSortedSet<E>
union(Iterable<? extends E> iter)
Returns a new set containing all the items.@NotNull ImSortedSet<E>
without(E key)
Removes this key from the set-
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Methods inherited from interface java.util.Set
add, addAll, clear, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface java.util.SortedSet
comparator, first, last, spliterator
-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
any, toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutList, toMutMap, toMutRrbt, toMutSet, toMutSortedMap, toMutSortedSet
-
-
-
-
Method Detail
-
put
@NotNull @NotNull ImSortedSet<E> put(E e)
Adds an element. If the element already exists in this set, the new value overwrites the old one. If the new element is the same as an old element (based on the address of that item in memory, not an equals test), the old set may be returned unchanged.
-
without
@NotNull @NotNull ImSortedSet<E> without(E key)
Removes this key from the set
-
headSet
@NotNull default @NotNull ImSortedSet<E> headSet(E toElement)
-
iterator
@NotNull @NotNull UnmodSortedIterator<E> iterator()
Iterates over contents in a guaranteed order. Iterates over contents with no guarantees about their ordering. An unmodifiable iterator A one-time use, mutable, not-thread-safe way to get each value of the underling collection in turn. I experimented with various thread-safe alternatives, but the JVM is optimized around iterators so this is the lowest common denominator of collection iteration, even though iterators are inherently mutable.- Specified by:
iterator
in interfaceCollection<E>
- Specified by:
iterator
in interfaceIterable<E>
- Specified by:
iterator
in interfaceSet<E>
- Specified by:
iterator
in interfaceUnmodCollection<E>
- Specified by:
iterator
in interfaceUnmodIterable<E>
- Specified by:
iterator
in interfaceUnmodSet<E>
- Specified by:
iterator
in interfaceUnmodSortedCollection<E>
- Specified by:
iterator
in interfaceUnmodSortedIterable<E>
- Specified by:
iterator
in interfaceUnmodSortedSet<E>
-
subSet
@NotNull @NotNull ImSortedSet<E> subSet(E fromElement, E toElement)
Return the elements in this set from the start element (inclusive) to the end element (exclusive)
-
tailSet
@NotNull @NotNull ImSortedSet<E> tailSet(E fromElement)
-
-