public class HashedList.HashedListIterator extends Object implements Cursor
This class can be used by external users to both add and delete elements from the list. It implements the standard Iterator interface but also provides methods to add keyed or unkeyed elements at the current location.
Users may move either direction in the list using the next and prev calls. Note that a call to prev followed by a call to next (or vice versa) will return the same element twice.
The class is implemented as an inner class so that it can easily access the state of the associated HashedList.
Modifier and Type | Method and Description |
---|---|
void |
add(Object ref)
Add an entry at the current location.
|
void |
add(Object key,
Object ref)
Add a keyed entry at the current location.
|
boolean |
hasNext()
Is there another element?
|
boolean |
hasPrev()
Is there a previous element?
|
Object |
next()
Get the next entry.
|
Object |
prev()
Get the previous entry.
|
void |
remove()
Remove the last retrieved entry.
|
void |
setKey(Object key)
Point the iterator to a particular keyed entry.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public boolean hasNext()
public boolean hasPrev()
public Object next() throws NoSuchElementException
next
in interface Iterator
NoSuchElementException
public Object prev() throws NoSuchElementException
prev
in interface Cursor
NoSuchElementException
public void remove()
public void add(Object ref)
public void add(Object key, Object ref)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.