SetIterator
| Kind of class: | internal class |
|---|---|
| Package: | com.bourre.collection |
| Inherits from: | none |
| Implements: | |
| Classpath: | com.bourre.collection.SetIterator |
| File last modified: | Monday, 24 November 2008, 11:36:50 |
Summary
Constructor
- SetIterator (c:Set, index:uint = 0)
Instance methods
- hasNext : Boolean
- Returns true if the iteration has more elements.
- next : *
- Returns the next element in the iteration.
- previous : *
- Returns the previous element in the list.
- remove : void
- Removes from the underlying collection the last element returned
- add (o:Object) : void
- Inserts the specified element into the list (optional operation).
- hasPrevious : Boolean
- Returns true if this list iterator has more elements when
- nextIndex : uint
- Returns the index of the element that would be returned
- previousIndex : uint
- Returns the index of the element that would be returned
- set (o:Object) : void
- Replaces the last element returned by next or previous
- set (o:Object) : void
Constructor
SetIterator
Instance methods
add
public function add (o:Object) : voidInserts the specified element into the list (optional operation).#
The element is inserted immediately before the next element that
would be returned by next, if any, and after the next element
that would be returned by previous, if any. (If the list contains
no elements, the new element becomes the sole element on the list.)
The new element is inserted before the implicit cursor: a subsequent
call to next would be unaffected, and a subsequent call to previous
would return the new element. (This call increases by one the value
that would be returned by a call to nextIndex or previousIndex.)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 () : BooleanReturns true if the iteration has more elements.#
(In other words, returns true if next would return
an element rather than throwing an exception.)Returns:- {VISDOC_CODE_BLOCK_0} if the iterator has more elements.#
Specified by:hasPrevious
public function hasPrevious () : BooleanReturns true if this list iterator has more elements when#
traversing the list in the reverse direction. (In other words,
returns {VISDOC_CODE_BLOCK_14} if previous would return an element
rather than throwing an exception.)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 () : *Returns the next element in the iteration. Calling this method#
repeatedly until the hasNext() method returns false will return
each element in the underlying collection exactly once.nextIndex
public function nextIndex () : uintReturns the index of the element that would be returned#
by a subsequent call to next. (Returns list size if the
list iterator is at the end of the list.)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 () : *Returns the previous element in the list. This method#
may be called repeatedly to iterate through the list
backwards, or intermixed with calls to next to go back
and forth. (Note that alternating calls to next and
previous will return the same element repeatedly.)previousIndex
public function previousIndex () : uintReturns the index of the element that would be returned#
by a subsequent call to previous. (Returns {VISDOC_CODE_BLOCK_17}if the list iterator is at the beginning of the list.)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 () : voidRemoves from the underlying collection the last element returned#
by the iterator (optional operation). This method can be called
only once per call to next. The behavior of an iterator is unspecified
if the underlying collection is modified while the iteration is in
progress in any way other than by calling this method.Specified by:set
public function set (o:Object) : voidReplaces the last element returned by next or previous#
with the specified element (optional operation).
This call can be made only if neither {VISDOC_CODE_BLOCK_19}nor {VISDOC_CODE_BLOCK_20} have been called after the last
call to next or previous.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: - previousIndex : uint
- nextIndex : uint
- hasPrevious : Boolean
- add (o:Object) : void
- remove : void
- previous : *
- next : *