Class FixedListIterator
java.lang.Object
ch.tocco.nice2.conditionals.api.tree.util.FixedListIterator
- All Implemented Interfaces:
Iterator<Node>
,ListIterator<Node>
A list iterator for fixed-length lists that are a list-representation of fields. An example of such a list can be
found in
EquationNode
:
```java
assert equationNode.get(0) == equationNode.getLeft();
assert equationNode.get(1) == equationNode.getRight();
```
Because the lists are of fixed length, this iterator can keep a consistent state and behaviour even if the list is
modified during iteration. It therefore doesn't throw any ConcurrentModificationException
s. Also, for the
same reason, it doesn't support the ListIterator.add(Object)
and ListIterator.remove()
operations.
It *does* support ListIterator.set(Object)
, however.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
A handle to map the list elements to their underlying fields. -
Constructor Summary
-
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Constructor Details
-
FixedListIterator
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
hasPrevious
public boolean hasPrevious()- Specified by:
hasPrevious
in interfaceListIterator<Node>
-
previous
- Specified by:
previous
in interfaceListIterator<Node>
-
nextIndex
public int nextIndex()- Specified by:
nextIndex
in interfaceListIterator<Node>
-
previousIndex
public int previousIndex()- Specified by:
previousIndex
in interfaceListIterator<Node>
-
remove
public void remove() -
set
- Specified by:
set
in interfaceListIterator<Node>
-
add
- Specified by:
add
in interfaceListIterator<Node>
-