Package elki.database.ids
Interface DBIDIter
-
- All Known Subinterfaces:
DBIDArrayIter,DBIDArrayMIter,DBIDMIter,DoubleDBIDIter,DoubleDBIDListIter,DoubleDBIDListMIter,DoubleIntegerDBIDListIter,DoubleIntegerDBIDListMIter,IntegerDBIDArrayIter,IntegerDBIDArrayMIter,IntegerDBIDIter,IntegerDBIDMIter,PrioritySearcher<O>
- All Known Implementing Classes:
ArrayModifiableIntegerDBIDs.Itr,ArrayModifiableIntegerDBIDs.Slice.SliceItr,ArrayStaticIntegerDBIDs.Itr,ArrayStaticIntegerDBIDs.Slice.SliceItr,CoverTree.CoverTreePriorityDBIDSearcher,CoverTree.CoverTreePriorityObjectSearcher,CoverTree.CoverTreePrioritySearcher,DoubleIntegerDBIDArrayList.Itr,DoubleIntegerDBIDHeap.UnorderedIter,DoubleIntegerDBIDKNNHeap.UnorderedIter,DoubleIntegerDBIDSubList.Itr,EmptyDBIDs.EmptyDBIDIterator,EuclideanRStarTreeDistancePrioritySearcher,ExactPrioritySearcher,FastutilIntOpenHashSetModifiableDBIDs.Itr,GNAT.GNATPriorityDBIDSearcher,GNAT.GNATPriorityObjectSearcher,GNAT.GNATPrioritySearcher,IntegerDBID.Itr,IntegerDBIDKNNSubList.Itr,IntegerDBIDPair.Itr,IntegerDBIDPair.Slice.SliceItr,IntegerDBIDRange.Itr,IntegerDBIDVar.Itr,LinearScanEuclideanPrioritySearcher,LinearScanEuclideanPrioritySearcher.ByDBID,LinearScanEuclideanPrioritySearcher.ByObject,LinearScanPrioritySearcher,LinearScanPrioritySearcher.ByDBID,LinearScanPrioritySearcher.ByObject,MemoryKDTree.KDTreePrioritySearcher,MinimalisticMemoryKDTree.KDTreePrioritySearcher,PrecomputedDistanceMatrix.PrecomputedDistancePrioritySearcher,RStarTreeDistancePrioritySearcher,SimplifiedCoverTree.CoverTreePriorityDBIDSearcher,SimplifiedCoverTree.CoverTreePriorityObjectSearcher,SimplifiedCoverTree.CoverTreePrioritySearcher,SmallMemoryKDTree.KDTreePrioritySearcher,UnmodifiableIntegerArrayDBIDs.Itr,UnmodifiableIntegerDBIDs.UnmodifiableDBIDIter,VPTree.VPTreePriorityDBIDSearcher,VPTree.VPTreePriorityObjectSearcher,VPTree.VPTreePrioritySearcher,WrappedPrioritySearchDBIDByLookup,WrappedPrioritySearchDBIDByLookup.Linear
public interface DBIDIter extends DBIDRef, Iter
Iterator for DBIDs.Important note: this iterator has a significantly different syntax and semantics than the Java iterators. It is much more aligned with C than with Java, but at the same time, the syntax is much more compatible with for loops.
Usage example:
We list some fundamental differences.for (DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) { Object o = relation.get(iter); // Many interfaces allow direct use DBID id = DBIDUtil.deref(iter); // Materialize only if you need to! }iter.valid()refers to the current element,Iterator.next()to the next.iter.advance()does not return an element. Useget...to access it.DBIDIter.get...do not advance the iterator.
- Since:
- 0.5.0
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T extends ModifiableDBIDs>
TaddTo(T collection)Add all remaining elements of an iterator to an existing collection.DBIDIteradvance()Moves the iterator forward to the next entry.-
Methods inherited from interface elki.database.ids.DBIDRef
equals, hashCode, internalGetIndex
-
-
-
-
Method Detail
-
advance
DBIDIter advance()
Description copied from interface:IterMoves the iterator forward to the next entry.
-
addTo
default <T extends ModifiableDBIDs> T addTo(T collection)
Add all remaining elements of an iterator to an existing collection.- Type Parameters:
T- Collection type- Parameters:
collection- Existing collection- Returns:
- The existing collection
-
-