Package com.ibm.wala.util.collections
Class NonNullSingletonIterator<T>
- java.lang.Object
-
- com.ibm.wala.util.collections.NonNullSingletonIterator<T>
-
- All Implemented Interfaces:
java.util.Iterator<T>
public class NonNullSingletonIterator<T> extends java.lang.Object implements java.util.Iterator<T>
A singleton iterator for an object which is guaranteed to be not-null. Exploiting this invariant allows this class to be slightly more efficient than Collections.iterator()
-
-
Constructor Summary
Constructors Constructor Description NonNullSingletonIterator(T o)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
static <T> NonNullSingletonIterator<T>
make(T item)
T
next()
void
remove()
-
-
-
Constructor Detail
-
NonNullSingletonIterator
public NonNullSingletonIterator(T o)
- Parameters:
o
- the single object in this collection, must be non-null
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<T>
-
remove
public void remove() throws java.lang.UnsupportedOperationException
- Specified by:
remove
in interfacejava.util.Iterator<T>
- Throws:
java.lang.UnsupportedOperationException
-
make
public static <T> NonNullSingletonIterator<T> make(T item)
-
-