Package de.lmu.ifi.dbs.elki.utilities.datastructures.iterator

ELKI Iterator API.

See: Description


Package de.lmu.ifi.dbs.elki.utilities.datastructures.iterator Description

ELKI Iterator API.

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. Also the GNU trove libraries - used by ELKI in various places - use the same kind of iterators.

ELKI Version 0.7.1

Copyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.