| JGL - The Generic Collection Library for Java |
All Packages Class Hierarchy This Package Previous Next Index
Class com.objectspace.jgl.util.ReverseIterator
java.lang.Object
|
+----com.objectspace.jgl.util.ReverseIterator
- public final class ReverseIterator
- extends Object
- implements BidirectionalIterator, Serializable
A ReverseIterator is a bidirectional iterator that allows
you to iterate backwards through the contents of a data structure that
supports bidirectional iteration.
- See Also:
- BidirectionalIterator
-
ReverseIterator(BidirectionalIterator)
- Construct myself to operate using a bidirectional iterator.
-
ReverseIterator(ReverseIterator)
- Construct myself to be a copy of an existing iterator.
-
advance()
- Advance by one.
-
advance(int)
- Advance by a specified amount.
-
atBegin()
- Return true if I'm positioned at the first item of my input stream.
-
atEnd()
- Return true if I'm positioned after the last item in my input stream.
-
clone()
- Return a clone of myself.
-
distance(ForwardIterator)
- Return the distance from myself to another iterator.
-
equals(Object)
- Return true if a specified object is the same kind of iterator as me
and is positioned at the same element.
-
equals(ReverseIterator)
- Return true if iterator is positioned at the same element as me.
-
get()
- Return the object at my current position.
-
get(int)
- Return the object that is a specified distance from my current position.
-
getContainer()
- Return my associated container via my BidirectionalIterator.
-
hasMoreElements()
- Return true if there are more elements in my input stream.
-
isCompatibleWith(InputIterator)
- Return true if both
iterator
and myself can be used
as a range.
-
nextElement()
- Return the next element in my input stream.
-
put(int, Object)
- Write an object at a specified distance from my current position.
-
put(Object)
- Set the object at my current position to a specified value.
-
retreat()
- Retreat by one.
-
retreat(int)
- Retreat by a specified amount.
ReverseIterator
public ReverseIterator(BidirectionalIterator iterator)
- Construct myself to operate using a bidirectional iterator.
- Parameters:
- iterator - The iterator to use.
ReverseIterator
public ReverseIterator(ReverseIterator iterator)
- Construct myself to be a copy of an existing iterator.
- Parameters:
- iterator - The iterator to copy.
clone
public Object clone()
- Return a clone of myself.
- Overrides:
- clone in class Object
atEnd
public boolean atEnd()
- Return true if I'm positioned after the last item in my input stream.
atBegin
public boolean atBegin()
- Return true if I'm positioned at the first item of my input stream.
equals
public boolean equals(Object object)
- Return true if a specified object is the same kind of iterator as me
and is positioned at the same element.
- Parameters:
- object - Any object.
- Overrides:
- equals in class Object
equals
public boolean equals(ReverseIterator iterator)
- Return true if iterator is positioned at the same element as me.
- Parameters:
- iterator - The iterator to compare myself against.
hasMoreElements
public boolean hasMoreElements()
- Return true if there are more elements in my input stream.
advance
public void advance()
- Advance by one.
advance
public void advance(int n)
- Advance by a specified amount.
- Parameters:
- n - The amount to advance.
retreat
public void retreat()
- Retreat by one.
retreat
public void retreat(int n)
- Retreat by a specified amount.
- Parameters:
- n - The amount to retreat.
nextElement
public Object nextElement()
- Return the next element in my input stream.
get
public Object get()
- Return the object at my current position.
put
public void put(Object object)
- Set the object at my current position to a specified value.
- Parameters:
- object - The object to be written at my current position.
distance
public int distance(ForwardIterator iterator)
- Return the distance from myself to another iterator.
I should be before the specified iterator.
- Parameters:
- iterator - The iterator to compare myself against.
get
public Object get(int offset)
- Return the object that is a specified distance from my current position.
- Parameters:
- offset - The offset from my current position.
put
public void put(int offset,
Object object)
- Write an object at a specified distance from my current position.
- Parameters:
- offset - The offset from my current position.
- object - The object to write.
getContainer
public Container getContainer()
- Return my associated container via my BidirectionalIterator.
isCompatibleWith
public boolean isCompatibleWith(InputIterator iterator)
- Return true if both
iterator
and myself can be used
as a range.
All Packages Class Hierarchy This Package Previous Next Index