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 ArrayIterator class provides a convenient way
to 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

Constructor

ArrayIterator

public function ArrayIterator (
a:Array, i:uint = 0)

Creates a new iterator for the passed-in array.
Parameters:
a:
Array iterator's target
i:
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:
  • ArrayIterator if 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.
    #

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:

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.
    #

remove

public function remove (
) : void

Throws:
  • {VISDOC_LINK_0}List — if the remove operation is not
    supported by this Iterator.
    #
  • {VISDOC_LINK_1}0 — if the next method has not yet been called,
    or the remove method has already been called after the last
    call to the next method.
    #
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.
#
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: