| JGL - The Generic Collection Library for Java |
All Packages Class Hierarchy This Package Previous Next Index
Class com.objectspace.jgl.HashMapIterator
java.lang.Object
|
+----com.objectspace.jgl.HashMapIterator
- public final class HashMapIterator
- extends Object
- implements ForwardIterator, Opaque
A HashMapIterator is a forward iterator that allows you to iterate through
the contents of a HashMap. It has a mode that allows selection of the current
position's key, value, or key-value pair.
- See Also:
- ForwardIterator
-
KEY
-
-
PAIR
-
-
VALUE
-
-
HashMapIterator()
- Construct myself to be an iterator with no associated data structure or position.
-
HashMapIterator(HashMapIterator)
- 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.
-
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.
-
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.
-
key()
- Return the key of my current key/value pair.
-
nextElement()
- Return the next element in my input stream.
-
opaqueData()
- Should not be used directly.
-
opaqueId()
- Should not be used directly.
-
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.
-
value()
- Return the value of my current key/value pair.
-
value(Object)
- Change the value of my current key/value pair.
PAIR
public static final int PAIR
KEY
public static final int KEY
VALUE
public static final int VALUE
HashMapIterator
public HashMapIterator()
- Construct myself to be an iterator with no associated data structure or position.
HashMapIterator
public HashMapIterator(HashMapIterator 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
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
atBegin
public boolean atBegin()
- Return true if I'm positioned at the first item of my input stream.
atEnd
public boolean atEnd()
- Return true if I'm positioned after the last item in my input stream.
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.
- Throws: InvalidOperationException
- If the parameter is less than zero.
nextElement
public Object nextElement()
- Return the next element in my input stream.
- Throws: NoSuchElementException
- If I'm positioned at an invalid position.
get
public Object get()
- Return the object at my current position.
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.
- Throws: InvalidOperationException
- If the parameter is less than zero.
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.
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.
- Throws: InvalidOperationException
- If the parameter is less than zero.
key
public Object key()
- Return the key of my current key/value pair.
value
public Object value()
- Return the value of my current key/value pair.
value
public void value(Object value)
- Change the value of my current key/value pair.
- Parameters:
- object - The new value.
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.
getContainer
public Container getContainer()
- Return my associated container.
isCompatibleWith
public boolean isCompatibleWith(InputIterator iterator)
- Return true if both
iterator
and myself can be used
as a range.
opaqueData
public Object opaqueData()
- Should not be used directly.
- See Also:
- Opaque
opaqueId
public int opaqueId()
- Should not be used directly.
- See Also:
- Opaque
All Packages Class Hierarchy This Package Previous Next Index