public interface ValueIterator
ValueIterator vit = ...;
vit.bottomUpInit();
while(vit.hasNext()){
int v = vit.next();
// operate on value v here
}
OR
ValueIterator vit = ...;
vit.topDownInit();
while(vit.hasPrevious()){
int v = vit.previous();
// operate on value v here
}| Modifier and Type | Method and Description |
|---|---|
void |
bottomUpInit()
|
boolean |
hasNext()
Returns true if the iteration has more values.
|
boolean |
hasPrevious()
Returns true if the iteration has more ranges.
|
int |
next()
Compute and return the next value.
|
int |
previous()
Compute and return the previous value.
|
void |
topDownInit()
Prepare iteration from highest value to smallest value (using
hasPrevious() / previous())
ValueIterator vit = ...;
vit.topDownInit();
while(vit.hasPrevious()){
int v = vit.previous();
// operate on value v here
} |
void bottomUpInit()
void topDownInit()
hasPrevious() / previous())
ValueIterator vit = ...;
vit.topDownInit();
while(vit.hasPrevious()){
int v = vit.previous();
// operate on value v here
}boolean hasNext()
ValueIterator vit = ...;
vit.bottomUpInit();
while(vit.hasNext()){
int v = vit.next();
// operate on value v here
}
OR
boolean hasPrevious()
ValueIterator vit = ...;
vit.topDownInit();
while(vit.hasPrevious()){
int v = vit.previous();
// operate on value v here
}int next()
ValueIterator vit = ...;
vit.bottomUpInit();
while(vit.hasNext()){
int v = vit.next();
// operate on value v here
}
OR
int previous()
ValueIterator vit = ...;
vit.topDownInit();
while(vit.hasPrevious()){
int v = vit.previous();
// operate on value v here
}Copyright © 2017. All rights reserved.