Initial commit from SVN.
This commit is contained in:
51
Common/src/com/common/util/EmptyIterator.java
Normal file
51
Common/src/com/common/util/EmptyIterator.java
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2005,2008 Declarative Engineering LLC.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Declarative Engineering LLC
|
||||
* verson 1 which accompanies this distribution, and is available at
|
||||
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
|
||||
*/
|
||||
package com.common.util;
|
||||
|
||||
/*
|
||||
* A simple empty iterator singleton.
|
||||
*/
|
||||
public final class EmptyIterator implements IIterator {
|
||||
/** The one and only empty iterator object. */
|
||||
private static EmptyIterator singleton = new EmptyIterator();
|
||||
/**
|
||||
* Gets the single instance of this iterator.
|
||||
* @return The one and only empty iterator object.
|
||||
*/
|
||||
public static IIterator getSingleton() {
|
||||
return singleton;
|
||||
}//getSingleton()//
|
||||
/**
|
||||
* EmptyIterator constructor.
|
||||
*/
|
||||
private EmptyIterator() {
|
||||
}//EmptyIterator()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.common.util.IIterator#hasNext()
|
||||
*/
|
||||
public boolean hasNext() {
|
||||
return false;
|
||||
}//hasNext()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.common.util.IIterator#next()
|
||||
*/
|
||||
public Object next() {
|
||||
throw new IndexOutOfBoundsException("Empty iterator.");
|
||||
}//next()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.common.util.IIterator#remove()
|
||||
*/
|
||||
public boolean remove() {
|
||||
return false;
|
||||
}//remove()//
|
||||
/* (non-Javadoc)
|
||||
* @see com.common.util.IIterator#resetToFront()
|
||||
*/
|
||||
public void resetToFront() {
|
||||
}//resetToFront()//
|
||||
}//EmptyIterator//
|
||||
Reference in New Issue
Block a user