net.sf.mmm.util.lang.base
Class SequenceCharIterator

java.lang.Object
  extended by net.sf.mmm.util.lang.base.SequenceCharIterator
All Implemented Interfaces:
CharIterator

public class SequenceCharIterator
extends Object
implements CharIterator

This is an implementation of the CharIterator interface that simply iterates a given CharSequence.

Since:
1.0.2
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  int index
          The current index in sequence.
private  int length
          The length of the sequence.
private  CharSequence sequence
           
 
Fields inherited from interface net.sf.mmm.util.lang.api.CharIterator
END_OF_ITERATOR
 
Constructor Summary
SequenceCharIterator(CharSequence sequence)
          The constructor.
 
Method Summary
 boolean hasNext()
          This method determines whether there is a next char available or the end of this iterator has been reached.
 char next()
          This method returns the next character to iterate or CharIterator.END_OF_ITERATOR if the end of this iterator has been reached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sequence

private final CharSequence sequence
See Also:
SequenceCharIterator(CharSequence)

length

private final int length
The length of the sequence.


index

private int index
The current index in sequence.

Constructor Detail

SequenceCharIterator

public SequenceCharIterator(CharSequence sequence)
The constructor.

Parameters:
sequence - the CharSequence to iterate char by char.
Method Detail

hasNext

public boolean hasNext()
This method determines whether there is a next char available or the end of this iterator has been reached.

Specified by:
hasNext in interface CharIterator
Returns:
true if there is at least one next char available, or false if the end of this iterator has been reached and further calls of CharIterator.next() will return CharIterator.END_OF_ITERATOR.
See Also:
CharIterator.next(), Iterator.hasNext()

next

public char next()
This method returns the next character to iterate or CharIterator.END_OF_ITERATOR if the end of this iterator has been reached. If CharIterator.END_OF_ITERATOR is returned further calls will always return CharIterator.END_OF_ITERATOR.

Specified by:
next in interface CharIterator
Returns:
the next character or CharIterator.END_OF_ITERATOR if the end of this iterator has been reached.
See Also:
Iterator.next()


Copyright © 2001-2010 mmm-Team. All Rights Reserved.