Package elki.utilities.datastructures.iterator
ELKI uses a custom iterator API instead of the usual
Iterator
classes (the "Java Collections API").
The reason for this is largely efficiency. Benchmarking showed that the Java
Iterator API can be quite expensive when dealing with primitive types, as
Iterator.next()
is meant to always return an object.
However, the benefits become more apparent when considering multi-valued iterators. For example an iterator over a k nearest neighbor set in ELKI both represents an object by its DBID, and a distance value. For double-valued distances, it can be retrieved using a primitive value getter (saving an extra object copy), and since the iterator can be used as a DBIDRef, it can also represent the current object without creating additional objects.
While it may seem odd to depart from Java conventions such as the collections API, note that these iterators are very close to the standard C++ conventions, so nothing entirely unusual.
-
Interface Summary Interface Description ArrayIter Array iterators can also go backwards and seek.It<O> Object iterator interface.Iter Iterator interface for more than one return value.MIter Modifiable iterator, that also supports removal. -
Class Summary Class Description ArrayListIter<O> ELKI style Iterator for array lists.ConcatIt<O> Concatenate multiple iterators.EmptyIterator<O> Empty object iterator.FilteredIt<O> Filtered iterator.IterableIt<O> ELKI style Iterator wrapper for collections.SubtypeIt<O> Filtered iterator.