LimeWire collection component api

org.limewire.collection
Class EmptyIterator

java.lang.Object
  extended by org.limewire.collection.UnmodifiableIterator
      extended by org.limewire.collection.EmptyIterator
All Implemented Interfaces:
java.util.Iterator

public class EmptyIterator
extends UnmodifiableIterator

Provides an unmodifiable empty iterator. EmptyIterator always returns that there aren't any more items and throws a NoSuchElementException when attempting to move to the next item.

    try{
        EmptyIterator ei = new EmptyIterator();     
        ei.next();      
    } catch (Exception e) {
        System.out.println("Expected to get NoSuchElementException exception: " + e.toString());
    }

    Output:
        Expected to get NoSuchElementException exception: java.util.NoSuchElementException
 


Field Summary
static java.util.Iterator EMPTY_ITERATOR
          A constant EmptyIterator.
 
Constructor Summary
EmptyIterator()
           
 
Method Summary
static
<T> java.util.Iterator<T>
emptyIterator()
           
 boolean hasNext()
           
 java.lang.Object next()
           
 
Methods inherited from class org.limewire.collection.UnmodifiableIterator
remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_ITERATOR

public static final java.util.Iterator EMPTY_ITERATOR
A constant EmptyIterator.

Constructor Detail

EmptyIterator

public EmptyIterator()
Method Detail

emptyIterator

public static <T> java.util.Iterator<T> emptyIterator()

hasNext

public boolean hasNext()

next

public java.lang.Object next()

LimeWire collection component api

Copyright © 2009 Lime Wire LLC. All Rights Reserved.