|
SoftNet-Consult Java Utility Library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softnetConsult.utils.collections.ReadOnlyIterator<T>
T
- A class type of the objects over which this iterator iterates.public class ReadOnlyIterator<T>
A generic read-only iterator.
A ReadOnlyIterator<T>
object wraps around an Iterator<? extends T>
object and simply forwards all read-only method calls to it. Modifying
operations (i.e. remove
throw a UnsupportedOperationException
.
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: ReadOnlyIterator.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.
Field Summary | |
---|---|
private java.util.Iterator<? extends T> |
iterator
The encapsulated generic iterator; |
Constructor Summary | |
---|---|
ReadOnlyIterator(java.lang.Iterable<? extends T> iterable)
Creates a read-only iteretor for the iterator over the specified iterable object. |
|
ReadOnlyIterator(java.util.Iterator<? extends T> iterator)
Creates a read-only iteretor for the specified iterator. |
Method Summary | |
---|---|
boolean |
hasNext()
Returns true if the iteration has more elements. |
T |
next()
Returns the next element in the iteration. |
void |
remove()
Always throws UnsupportedOperationException . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private java.util.Iterator<? extends T> iterator
Constructor Detail |
---|
public ReadOnlyIterator(java.util.Iterator<? extends T> iterator)
iterator
- An iterator.public ReadOnlyIterator(java.lang.Iterable<? extends T> iterable)
iterable
- An iterable object whose iterator will be wraped by this read only iterator.Method Detail |
---|
public boolean hasNext()
true
if the iteration has more elements.
(In other words, returns true
if true
would return an
element rather than throwing an exception.)
hasNext
in interface java.util.Iterator<T>
true
if the iterator has more elements.public T next()
next
in interface java.util.Iterator<T>
java.util.NoSuchElementException
- iteration has no more elements.public void remove()
UnsupportedOperationException
.
remove
in interface java.util.Iterator<T>
java.lang.UnsupportedOperationException
- Always thrown since this is a read-only iterator.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |