You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
462 B
29 lines
462 B
3 years ago
|
package patronIterator;
|
||
|
|
||
|
public class IteradorVector {
|
||
|
private int[] datosVector;
|
||
|
private int posicion;
|
||
|
|
||
|
public IteradorVector(Vector vector) {
|
||
|
datosVector = vector.getDatos();
|
||
|
this.posicion = 0;
|
||
|
}
|
||
|
|
||
|
public boolean hasNext() {
|
||
|
if(posicion < datosVector.length){
|
||
|
return true;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public Object next(){
|
||
|
int valor = datosVector[posicion];
|
||
|
posicion++;
|
||
|
return valor;
|
||
|
}
|
||
|
|
||
|
public void reset() {
|
||
|
posicion=0;
|
||
|
}
|
||
|
}
|