Interface It<O>
-
- Type Parameters:
O
- Object type.
- All Superinterfaces:
Iter
- All Known Implementing Classes:
ArrayListIter
,ConcatIt
,EmptyIterator
,FilteredIt
,HashMapHierarchy.ItrAll
,HashMapHierarchy.ItrAnc
,HashMapHierarchy.ItrDesc
,HashMapHierarchy.Rec.ItrChildren
,HashMapHierarchy.Rec.ItrChildrenReverse
,HashMapHierarchy.Rec.ItrParents
,HashMapHierarchy.Rec.ItrParentsReverse
,IterableIt
,Metadata.EagerIt
,Metadata.Hierarchy.ItrAnc
,Metadata.Hierarchy.ItrChildren
,Metadata.Hierarchy.ItrChildrenReverse
,Metadata.Hierarchy.ItrDesc
,Metadata.Hierarchy.ItrParents
,Metadata.Hierarchy.ItrParentsReverse
,StackedIter
,SubtypeIt
public interface It<O> extends Iter
Object iterator interface. This is the most common case, hence the short class name. Several operations (such as filter and forEach) can only be defined if we know the data type. But for primitive values and, e.g., kNN lists (which have distance and objects), we cannot use this interface.- Since:
- 0.7.5
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description It<O>
advance()
Moves the iterator forward to the next entry.default <T extends java.util.Collection<? super O>>
Tcollect(T c)
Collect the output in a colection.default <T> It<T>
filter(java.lang.Class<? super T> clz)
Filtered iteration.default It<O>
filter(java.util.function.Predicate<? super O> predicate)
Filtered iteration.default boolean
find(java.lang.Object o)
Find a given object in the iterator; consumes the iterator.default void
forEach(java.util.function.Consumer<? super O> action)
Process the remaining elements - this will invalidate the iterator.O
get()
Access the current object.
-
-
-
Method Detail
-
get
O get()
Access the current object.- Returns:
- Current object
-
advance
It<O> advance()
Description copied from interface:Iter
Moves the iterator forward to the next entry.
-
filter
default <T> It<T> filter(java.lang.Class<? super T> clz)
Filtered iteration.Important: using the filtered iterator will also advance this iterator; so usually you should stop using the original iterator after calling this method.
- Parameters:
clz
- Class filter- Returns:
- Filtered iterator.
-
filter
default It<O> filter(java.util.function.Predicate<? super O> predicate)
Filtered iteration.Important: using the filtered iterator will also advance this iterator; so usually you should stop using the original iterator after calling this method.
- Parameters:
predicate
- Test- Returns:
- Filtered iterator.
-
find
default boolean find(java.lang.Object o)
Find a given object in the iterator; consumes the iterator.- Parameters:
o
- Object to find- Returns:
true
if found
-
forEach
default void forEach(java.util.function.Consumer<? super O> action)
Process the remaining elements - this will invalidate the iterator.- Parameters:
action
- Action to perform
-
collect
default <T extends java.util.Collection<? super O>> T collect(T c)
Collect the output in a colection.- Parameters:
c
- Collection
-
-