Package org.organicdesign.fp.collections
Interface ImSortedSet<E>
-
- All Superinterfaces:
BaseSet<E>,java.util.Collection<E>,java.lang.Iterable<E>,java.util.Set<E>,Sized,java.util.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
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default ImSortedSet<E>headSet(E toElement)UnmodSortedIterator<E>iterator()Iterates over contents in a guaranteed order.ImSortedSet<E>put(E e)Adds an element.ImSortedSet<E>subSet(E fromElement, E toElement)Return the elements in this set from the start element (inclusive) to the end element (exclusive)ImSortedSet<E>tailSet(E fromElement)default ImSortedSet<E>union(java.lang.Iterable<? extends E> iter)Returns a new set containing all the items.ImSortedSet<E>without(E key)Removes this key from the set-
Methods inherited from interface java.util.Set
add, addAll, clear, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface org.organicdesign.fp.xform.Transformable
toImList, toImMap, toImRrbt, toImSet, toImSortedMap, toImSortedSet, toMutableList, toMutableMap, toMutableRrbt, toMutableSet, toMutableSortedMap, toMutableSortedSet
-
-
-
-
Method Detail
-
put
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
ImSortedSet<E> without(E key)
Removes this key from the set
-
headSet
default ImSortedSet<E> headSet(E toElement)
- Specified by:
headSetin interfacejava.util.SortedSet<E>- Specified by:
headSetin interfaceUnmodSortedSet<E>
-
iterator
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:
iteratorin interfacejava.util.Collection<E>- Specified by:
iteratorin interfacejava.lang.Iterable<E>- Specified by:
iteratorin interfacejava.util.Set<E>- Specified by:
iteratorin interfaceUnmodCollection<E>- Specified by:
iteratorin interfaceUnmodIterable<E>- Specified by:
iteratorin interfaceUnmodSet<E>- Specified by:
iteratorin interfaceUnmodSortedCollection<E>- Specified by:
iteratorin interfaceUnmodSortedIterable<E>- Specified by:
iteratorin interfaceUnmodSortedSet<E>
-
subSet
ImSortedSet<E> subSet(E fromElement, E toElement)
Return the elements in this set from the start element (inclusive) to the end element (exclusive)- Specified by:
subSetin interfacejava.util.SortedSet<E>- Specified by:
subSetin interfaceUnmodSortedSet<E>
-
tailSet
ImSortedSet<E> tailSet(E fromElement)
- Specified by:
tailSetin interfacejava.util.SortedSet<E>- Specified by:
tailSetin interfaceUnmodSortedSet<E>
-
-