Package org.apache.commons.math4.linear
Class RealVector.SparseEntryIterator
java.lang.Object
org.apache.commons.math4.linear.RealVector.SparseEntryIterator
- All Implemented Interfaces:
java.util.Iterator<RealVector.Entry>
- Enclosing class:
- RealVector
protected class RealVector.SparseEntryIterator extends java.lang.Object implements java.util.Iterator<RealVector.Entry>
This class should rarely be used, but is here to provide
a default implementation of sparseIterator(), which is implemented
by walking over the entries, skipping those that are zero.
Concrete subclasses which are SparseVector implementations should
make their own sparse iterator, rather than using this one.
This implementation might be useful for ArrayRealVector, when expensive
operations which preserve the default value are to be done on the entries,
and the fraction of non-default values is small (i.e. someone took a
SparseVector, and passed it into the copy-constructor of ArrayRealVector)
-
Constructor Summary
Constructors Modifier Constructor Description protectedSparseEntryIterator()Simple constructor. -
Method Summary
Modifier and Type Method Description protected voidadvance(RealVector.Entry e)Advance an entry up to the next nonzero one.booleanhasNext()RealVector.Entrynext()voidremove()
-
Constructor Details
-
SparseEntryIterator
protected SparseEntryIterator()Simple constructor.
-
-
Method Details
-
advance
Advance an entry up to the next nonzero one.- Parameters:
e- entry to advance.
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfacejava.util.Iterator<RealVector.Entry>
-
next
- Specified by:
nextin interfacejava.util.Iterator<RealVector.Entry>
-
remove
- Specified by:
removein interfacejava.util.Iterator<RealVector.Entry>- Throws:
MathUnsupportedOperationException- in all circumstances.
-