ArrayIterator
| Kind of class: | public class |
|---|---|
| Package: | com.bourre.collection |
| Inherits from: | none |
| Implements: | |
| Author: | Cedric Nehemie |
| Classpath: | com.bourre.collection.ArrayIterator |
| File last modified: | Monday, 24 November 2008, 11:36:49 |
The
to iterate through each entry of an
as you could do with a
ArrayIterator class provides a convenient wayto iterate through each entry of an
Array instance as you could do with a
List instance.Iterations are performed from 0 to length
of the passed-in array.
See also:
Summary
Constructor
- ArrayIterator (a:Array, i:uint = 0)
- Creates a new iterator for the passed-in array.
Instance methods
- hasNext : Boolean
- next : *
- remove : void
- add (o:Object) : void
- hasPrevious : Boolean
- nextIndex : uint
- previous : *
- previousIndex : uint
- set (o:Object) : void
Constructor
ArrayIterator
public function ArrayIterator (
a:Array,
i:uint = 0)
Creates a new iterator for the passed-in array.
Parameters:
a:
Array iterator's targeti:
iterator's start index
Throws:
- {VISDOC_LINK_0}
NullPointerException— if the array's target is null - {VISDOC_LINK_1}
IndexOutOfBoundsException— if the index is out of range
Instance methods
add
public function add (
o:Object) : void
Parameters:
o:
the element to insert.
#Throws:
- {VISDOC_LINK_0}{VISDOC_CODE_BLOCK_10} — if the set operation#
is not supported by this list iterator. - {VISDOC_LINK_1}{VISDOC_CODE_BLOCK_11} — if the class of the specified#
element prevents it from being added to this list. - {VISDOC_LINK_2}{VISDOC_CODE_BLOCK_12} — if some aspect of the#
specified element prevents it from being added to this list. - {VISDOC_LINK_3}{VISDOC_CODE_BLOCK_13} — if neither next nor previous have#
been called, or remove or add have been called after
the last call to next or previous.
Specified by:
hasNext
public function hasNext (
) : Boolean
Returns:
- #
ArrayIteratorif the iterator has more elements.
Specified by:
hasPrevious
public function hasPrevious (
) : Boolean
Returns:
- {VISDOC_CODE_BLOCK_15} if the list iterator has more elements when#
traversing the list in the reverse direction.
Specified by:
next
public function next (
) : *
nextIndex
public function nextIndex (
) : uint
Returns:
- the index of the element that would be returned#
by a subsequent call to next, or list size if list
iterator is at end of list.
Specified by:
previous
public function previous (
) : *
previousIndex
public function previousIndex (
) : uint
Returns:
- the index of the element that would be returned#
by a subsequent call to previous, or {VISDOC_CODE_BLOCK_18} if list iterator is at beginning of list.
Specified by:
remove
public function remove (
) : void
Specified by:
set
public function set (
o:Object) : void
Parameters:
o:
the element with which to replace the last
element returned by next or previous.
#element returned by next or previous.
Throws:
- {VISDOC_LINK_0}{VISDOC_CODE_BLOCK_21} — if the set operation#
is not supported by this list iterator. - {VISDOC_LINK_1}{VISDOC_CODE_BLOCK_22} — if the class of the specified#
element prevents it from being added to this list. - {VISDOC_LINK_2}{VISDOC_CODE_BLOCK_23} — if some aspect of the#
specified element prevents it from being added to this list. - {VISDOC_LINK_3}{VISDOC_CODE_BLOCK_24} — if neither next nor previous have#
been called, or remove or add have been called after
the last call to next or previous.
Specified by: