01 
02 /*
03  *  JScripter Emulation 1.0 - To Script Java
04  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
05  *  
06  *  This program is free software: you can redistribute it and/or modify
07  *  it under the terms of the GNU Affero General Public License as published by
08  *  the Free Software Foundation, either version 3 of the License, or
09  *  (at your option) any later version.
10  *  
11  *  This program is distributed in the hope that it will be useful,
12  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  *  GNU Affero General Public License for more details.
15  *  
16  *  You should have received a copy of the GNU Affero General Public License
17  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 package org.jscripter.emu.java.util;
21 
22 /**
23  * <p><b>Internally</b> represents an iterator over a collection, emulating a standard 
24  * <tt>java.util</tt> interface or class with the same simple name as this one.</p>
25  * <p>This interface or class is only used internally by JS re-compiler implementations.</p>
26  * <p>Please refer to <a href="http://java.sun.com/docs/">the Java API Standards</a> for detail description of the original class or interface.</p>
27  * 
28  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
29  * 
30  * @javascript Re-compilers must redirect the resolution of the emulated original Java class or interface to this one.
31  */
32 public interface Iterator<E>
33 {
34     /**
35      * <p>Determines whether the iterator has more elements.</p>
36      * @return <tt>true</tt> if the iteration has more elements, i.e., if {@link #next()} would 
37      * return an element rather than throwing an exception.
38      * @since 1.0
39      * @javascript Re-compilers must report error on end-users directly using this method.
40      */
41     boolean hasNext();
42     /**
43      * <p>Returns the next element in the iteration.</p>
44      * @return The next element in the iteration.
45      * @throws java.util.NoSuchElementException if the iteration has no more elements.
46      * @since 1.0
47      * @javascript Re-compilers must report error on end-users directly using this method.
48      */
49     E next();
50     /**
51      * <p>Removes from the underlying collection the last element returned by the iterator (optional operation). This method can be called only once per call to next. The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method.</p>
52      * @throws java.lang.UnsupportedOperationException if the {@link #remove()} operation is not supported by this Iterator.
53      * @throws java.lang.IllegalStateException if the {@link #next()} method has not yet been called, 
54      * or the {@link #remove()} method has already been called after the last call to the {@link #next()} method.
55      * @since 1.0
56      * @javascript Re-compilers must report error on end-users directly using this method.
57      */
58     void remove();
59 }