Package org.organicdesign.fp.collections
Interface UnmodIterator<E>
-
- All Superinterfaces:
Iterator<E>
- All Known Subinterfaces:
UnmodListIterator<E>,UnmodSortedIterator<E>
- All Known Implementing Classes:
UnmodIterator.UnIterator,UnmodMap.UnEntry.EntryToUnEntryIter,UnmodMap.UnEntry.EntryToUnEntrySortedIter,UnmodMap.UnEntry.UnmodKeyIter,UnmodMap.UnEntry.UnmodSortedKeyIter,UnmodMap.UnEntry.UnmodSortedValIter,UnmodMap.UnEntry.UnmodValIter,UnmodSortedIterator.Wrapper
public interface UnmodIterator<E> extends Iterator<E>
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. This is called "Unmod" in the sense that it doesn't modify the underlying collection. Iterators are inherently mutable. The only safe way to handle them is to pass around IteraBLEs so that the ultimate client gets its own, unshared iteraTOR. Order is not guaranteed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classUnmodIterator.UnIteratorInstead of calling this directly, please useemptyUnmodIterator()instead
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method Description static <T> @NotNull UnmodIterator<T>emptyUnmodIterator()Returns the empty unmodifiable iterator.default voidremove()Deprecated.-
Methods inherited from interface java.util.Iterator
forEachRemaining, hasNext, next
-
-
-
-
Method Detail
-
remove
@Deprecated default void remove()
Deprecated.Not allowed - this is supposed to be unmodifiable
-
emptyUnmodIterator
@NotNull static <T> @NotNull UnmodIterator<T> emptyUnmodIterator()
Returns the empty unmodifiable iterator.
-
-