## org.apache.commons.math.linear
Class AbstractRealVector.SparseEntryIterator

    java.lang.Object
      org.apache.commons.math.linear.AbstractRealVector.SparseEntryIterator

All Implemented Interfaces:
  java.util.Iterator<RealVector.Entry>

Enclosing class:
  AbstractRealVector

    protected class AbstractRealVector.SparseEntryIterator

extends java.lang.Object
implements java.util.Iterator<RealVector.Entry>

This class should rare be used, but is here to provide a default implementation of sparseIterator(), which is implemented by walking over the entries, skipping those whose values are the default one. Concrete subclasses which are SparseVector implementations should make their own sparse iterator, not use 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)

Field Summary
`private AbstractRealVector.EntryImpl` `current` Current entry.
`private int` `dim` Dimension of the vector.
`private AbstractRealVector.EntryImpl` `next` Next entry.
`private AbstractRealVector.EntryImpl` `tmp` Temporary entry (reused on each call to `next()`.

Constructor Summary
`protected` `AbstractRealVector.SparseEntryIterator()` Simple constructor.

Method Summary
`protected void` `advance(AbstractRealVector.EntryImpl e)` Advance an entry up to the next non null one.
`boolean` `hasNext()`
`RealVector.Entry` `next()`
`void` `remove()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### dim

    private final int dim

  Dimension of the vector.

### tmp

    private AbstractRealVector.EntryImpl tmp

  Temporary entry (reused on each call to `next()`.

### current

    private AbstractRealVector.EntryImpl current

  Current entry.

### next

    private AbstractRealVector.EntryImpl next

  Next entry.

Constructor Detail

### AbstractRealVector.SparseEntryIterator

    protected AbstractRealVector.SparseEntryIterator()

  Simple constructor.

Method Detail

### advance

    protected void advance(AbstractRealVector.EntryImpl e)

  Advance an entry up to the next non null one.

  Parameters:
    `e` - entry to advance

### hasNext

    public boolean hasNext()

  Specified by:
    `hasNext` in interface `java.util.Iterator<RealVector.Entry>`

### next

    public RealVector.Entry next()

  Specified by:
    `next` in interface `java.util.Iterator<RealVector.Entry>`

### remove

    public void remove()

  Specified by:
    `remove` in interface `java.util.Iterator<RealVector.Entry>`

Copyright (c) 2003-2010 Apache Software Foundation