001         package com.croftsoft.core.util;
002    
003         import java.util.*;
004    
005         /*********************************************************************
006         * A singleton null object Iterator implementation.
007         *
008         * @version
009         *   2003-05-12
010         * @since
011         *   2003-05-10
012         * @author
013         *   <a href="https://www.croftsoft.com/">David Wallace Croft</a>
014         *********************************************************************/
015    
016         public final class  NullIterator
017           implements Iterator
018         //////////////////////////////////////////////////////////////////////
019         //////////////////////////////////////////////////////////////////////
020         {
021    
022         public static final NullIterator  INSTANCE = new NullIterator ( );
023    
024         //////////////////////////////////////////////////////////////////////
025         //////////////////////////////////////////////////////////////////////
026    
027         public boolean  hasNext ( ) { return false; }
028    
029         public Object  next ( ) { throw new NoSuchElementException ( ); }
030    
031         public void  remove ( ) {
032           throw new UnsupportedOperationException ( ); }
033    
034         //////////////////////////////////////////////////////////////////////
035         //////////////////////////////////////////////////////////////////////
036    
037         private  NullIterator ( ) { }
038    
039         //////////////////////////////////////////////////////////////////////
040         //////////////////////////////////////////////////////////////////////
041         }