-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIterator.java
More file actions
30 lines (23 loc) · 760 Bytes
/
Iterator.java
File metadata and controls
30 lines (23 loc) · 760 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import java.util.NoSuchElementException;
/** An <code>Iterator</code> returns the elements of collection one at a time
* provinding an efficient mean to traverse a data structure.
*
* @author Marcel Turcotte (turcotte@eecs.uottawa.ca)
*/
public interface Iterator<E> {
/**
* Returns true if the iteration has more elements. (In other
* words, returns true if next would return an element rather than
* throwing an exception.)
*
* @return true if the iterator has more elements.
*/
boolean hasNext();
/**
* Returns the next element in the interation.
*
* @return the next element in the iteration.
* @throws NoSuchElementException iteration has no more elements.
*/
E next();
}