KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > mckoi > util > IntegerIterator


1 /**
2  * com.mckoi.util.IntegerIterator 02 Jul 2000
3  *
4  * Mckoi SQL Database ( http://www.mckoi.com/database )
5  * Copyright (C) 2000, 2001, 2002 Diehl and Associates, Inc.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * Version 2 as published by the Free Software Foundation.
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 General Public License Version 2 for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * Version 2 along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19  *
20  * Change Log:
21  *
22  *
23  */

24
25 package com.mckoi.util;
26
27 /**
28  * An iterator for a list of integer's.
29  *
30  * @author Tobias Downer
31  */

32
33 public interface IntegerIterator {
34
35   /**
36    * Returns <tt>true</tt> if this list iterator has more elements when
37    * traversing the list in the forward direction. (In other words, returns
38    * <tt>true</tt> if <tt>next</tt> would return an element rather than
39    * throwing an exception.)
40    */

41   boolean hasNext();
42
43   /**
44    * Returns the next element in the list. This method may be called
45    * repeatedly to iterate through the list, or intermixed with calls to
46    * <tt>previous</tt> to go back and forth. (Note that alternating calls
47    * to <tt>next</tt> and <tt>previous</tt> will return the same element
48    * repeatedly.)
49    */

50   int next();
51
52   /**
53    * Returns <tt>true</tt> if this list iterator has more elements when
54    * traversing the list in the reverse direction. (In other words, returns
55    * <tt>true</tt> if <tt>previous</tt> would return an element rather than
56    * throwing an exception.)
57    */

58   boolean hasPrevious();
59
60   /**
61    * Returns the previous element in the list. This method may be called
62    * repeatedly to iterate through the list backwards, or intermixed with
63    * calls to <tt>next</tt> to go back and forth. (Note that alternating
64    * calls to <tt>next</tt> and <tt>previous</tt> will return the same
65    * element repeatedly.)
66    */

67   int previous();
68
69   /**
70    * Removes from the list the last element returned by the iterator.
71    * This method can be called only once per call to <tt>next</tt>. The
72    * behavior of an iterator is unspecified if the underlying collection is
73    * modified while the iteration is in progress in any way other than by
74    * calling this method.
75    * <p>
76    * Some implementations of IntegerIterator may choose to not implement this
77    * method, in which case an appropriate exception is generated.
78    */

79   void remove();
80
81 }
82
Popular Tags