StringIterator

Kind of class:public class
Package:com.bourre.collection
Inherits from:none
Implements:
Author:Cédric Néhémie
Classpath:com.bourre.collection.StringIterator
File last modified:Monday, 24 November 2008, 11:36:49
The StringIterator class provides a convenient way
to iterate through each character of a string as you could do with
a List instance.

Iterations are performed from 0 to the length
of the passed-in string.

See also:

Summary


Constructor
  • StringIterator (s:String, gap:Number = 1, i:uint = 0)
    • Creates a new string iterator to iterate through
Instance methods

Constructor

StringIterator

public function StringIterator (
s:String, gap:Number = 1, i:uint = 0)

Creates a new string iterator to iterate through
each character of the passed-in string.
Parameters:
s :
String iterator's target
gap:
 
i :
iterator's start index
Throws:
  • {VISDOC_LINK_0}NullPointerException — if the string'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}IllegalArgumentException — The passed-in string couldn't be added due to its length
Specified by:

hasNext

public function hasNext (
) : Boolean

Returns:
  • StringIterator 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}0 — if the remove operation is not
    supported by this Iterator.
    #
  • {VISDOC_LINK_1}length — 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}IllegalArgumentException — The passed-in string couldn't be set due to its length
Specified by: