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 booleanhasNext()static <T> NonNullSingletonIterator<T>make(T item)Tnext()voidremove()
-
-
-
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:
hasNextin interfacejava.util.Iterator<T>
-
remove
public void remove() throws java.lang.UnsupportedOperationException- Specified by:
removein interfacejava.util.Iterator<T>- Throws:
java.lang.UnsupportedOperationException
-
make
public static <T> NonNullSingletonIterator<T> make(T item)
-
-