CISC 323 Intro to Software Engineering
CISC 323 Intro to Software Engineering
CISC 323 Intro to Software Engineering
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
import java.util.Vec<strong>to</strong>r;<br />
class Vec<strong>to</strong>rEnumeration {<br />
// Represents where we are in the vec<strong>to</strong>r<br />
private int currentElement = 0;<br />
}<br />
// The vec<strong>to</strong>r we are iterating through<br />
private Vec<strong>to</strong>r v;<br />
public boolean hasMoreElements ()<br />
{<br />
return (currentElement < v.size());<br />
}<br />
public Object nextElement ()<br />
{<br />
Object returnElement = v.get (currentElement);<br />
currentElement++;<br />
return returnElement;<br />
}<br />
public Vec<strong>to</strong>rEnumeration (Vec<strong>to</strong>r v)<br />
{<br />
this.v = v;<br />
}