public interface VectorIterator extends Serializable
Usage:
Vector vector = ...;
VectorIterator iterator = vector.iterator();
while(iterator.hasNext()) {
int index = iterator.getIndex();
double value = iterator.getValue();
iterator.next();
}
Modifier and Type | Method and Description |
---|---|
int |
getIndex()
Returns the index of the element which the cursor points.
|
double |
getValue()
Returns the value of the element which the cursor points.
|
boolean |
hasNext()
Returns
true if the iteration has more elements. |
void |
next()
Trigger the cursor points to the next element of the vector.
|
boolean hasNext()
true
if the iteration has more elements. Otherwise, false
will be
returned.true
if the iteration has more elementsvoid next()
The getIndex()
while returns the index of the element which the cursor points.
The getValue()
()} while returns the value of the element which the cursor points.
The difference to the Iterator.next()
is that this can avoid the return of boxed
type.
int getIndex()
double getValue()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.