SoftNet-Consult Java Utility Library

com.softnetConsult.utils.collections
Class ArrayIteratorChar

java.lang.Object
  extended by com.softnetConsult.utils.collections.ArrayIteratorChar
All Implemented Interfaces:
ArrayIteratorPrimitive, java.util.Iterator<java.lang.Character>

public class ArrayIteratorChar
extends java.lang.Object
implements java.util.Iterator<java.lang.Character>, ArrayIteratorPrimitive

Implements an iterator over a char array.

This product includes software developed by the SoftNet-Consult Java Utility Library project and its contributors.
(http://java-tools.sourceforge.net)
Copyright (c) 2007-2008 SoftNet-Consult.
Copyright (c) 2007-2008 G. Paperin.
All rights reserved.

File: AttayIterator.java
Library API version: "2.02"
Java compliance version: "1.5"

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following terms and conditions are met:

1. Redistributions of source code must retain the above acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above acknowledgement of the SoftNet-Consult Java Utility Library project, the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. All advertising materials mentioning features or use of this software or any derived software must display the following acknowledgement:
This product includes software developed by the SoftNet-Consult Java Utility Library project and its contributors.

THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version:
"2.02"
Author:
Greg Paperin (http://www.paperin.org)

Field Summary
private  char[] array
          Array being iterated.
private  int cursor
          Cursor into the array.
 
Constructor Summary
ArrayIteratorChar(char[] array)
          Creates an array iterator over the specified array.
 
Method Summary
 boolean hasNext()
          Returns true if this iteration has more elements.
 java.lang.Character next()
          Returns the next element in this iteration converted to the appropriate wrapper type.
 char nextValue()
          Returns the next element in this iteration.
 void remove()
          Removing of array elements is obviously not supported.
 void restart()
          Resets the internal cursor of this iterator to point to the start of the unederlying array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

array

private char[] array
Array being iterated.


cursor

private int cursor
Cursor into the array.

Constructor Detail

ArrayIteratorChar

public ArrayIteratorChar(char[] array)
Creates an array iterator over the specified array.

Parameters:
array - Array to be iterated.
Method Detail

hasNext

public boolean hasNext()
Returns true if this iteration has more elements.

Specified by:
hasNext in interface java.util.Iterator<java.lang.Character>
Returns:
true if next() would return an element rather than throwing an exception, false otherwise.

nextValue

public char nextValue()
Returns the next element in this iteration.

Returns:
The next element in this iteration.
Throws:
java.util.NoSuchElementException - If this iteration has no more elements.

next

public java.lang.Character next()
Returns the next element in this iteration converted to the appropriate wrapper type.

Specified by:
next in interface java.util.Iterator<java.lang.Character>
Returns:
The next element in this iteration converted to the appropriate wrapper type.
Throws:
java.util.NoSuchElementException - If this iteration has no more elements.

remove

public void remove()
Removing of array elements is obviously not supported.

Specified by:
remove in interface java.util.Iterator<java.lang.Character>
Throws:
java.lang.UnsupportedOperationException - is always thrown.

restart

public void restart()
Resets the internal cursor of this iterator to point to the start of the unederlying array. This method allows traversing an array several times using the same iterator.


SoftNet-Consult Java Utility Library is a member of SourceForge.net