|
SoftNet-Consult Java Utility Library | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.softnetConsult.utils.collections.NullIterator<ET>
ET
- public final class NullIterator<ET>
Provides an Null Iterator: the methods of this class perform no action and no elements
are ever returned - this class can be used when a non-null
Iterator
object
must be specified, but no actual iteration indended.
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: NullIterator.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 static NullIterator<?> |
singeltonInstance
A singleton instance of the NullIterator . |
Constructor Summary | |
---|---|
NullIterator()
Constructs a new NullIterator . |
Method Summary | ||
---|---|---|
static
|
getSingeltonInstance()
Returns a singleton instance of NullIterator . |
|
static
|
getSingeltonInstance(java.lang.Class<T> iteratorElementType)
Returns a singleton instance of NullIterator . |
|
boolean |
hasNext()
Returns false as the NullIterator has nothing to iterate over. |
|
ET |
next()
Always throws a NoSuchElementException as the NullIterator has
nothing to iterate over. |
|
void |
remove()
Always throws a IllegalStateException as the NullIterator has
nothing to remove. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static NullIterator<?> singeltonInstance
NullIterator
.
Constructor Detail |
---|
public NullIterator()
NullIterator
.
Method Detail |
---|
public static <T> NullIterator<T> getSingeltonInstance()
NullIterator
.
T
- The type for the hypothetically iterated items.
NullIterator
instance.public static <T> NullIterator<T> getSingeltonInstance(java.lang.Class<T> iteratorElementType)
NullIterator
.
This method works in the same way as getSingeltonInstance()
, the
parameter can be used to explicity specify the iterator type.
T
- The type for the hypothetically iterated items.iteratorElementType
- The type for the hypothetically iterated items.
NullIterator
instance.public boolean hasNext()
false
as the NullIterator
has nothing to iterate over.
hasNext
in interface java.util.Iterator<ET>
false
.public ET next()
NoSuchElementException
as the NullIterator
has
nothing to iterate over.
next
in interface java.util.Iterator<ET>
java.util.NoSuchElementException
- Always, as the NullIterator
has nothing
to iterate over.public void remove()
IllegalStateException
as the NullIterator
has
nothing to remove.
remove
in interface java.util.Iterator<ET>
java.lang.IllegalStateException
- Always, as the NullIterator
has nothing
to remove.
|
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |