Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.cantaa.util;
 
Empty iterator

Author(s):
Hans Lesmeister
 
public class EmptyIterator<T> implements Iterator<T> {
   public boolean hasNext() {
      return false;
   }
   public T next() {
      throw new NoSuchElementException("Iterator is empty");
   }
   public void remove() {
      throw new NoSuchElementException("Iterator is empty");
   }
New to GrepCode? Check out our FAQ X