IndexListIterator che implementa Iterator mediante un array list. Implementazione di Iterator mediante cursore : ElementIterator per PositionList. Aggiunti alcuni metodi e spostato le classi IndexListIterator,ElementIterator nel package Iterator.
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
package arraylist;
|
||||
|
||||
import iterator.IndexListIterator;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created with xgiovio.macbookair.
|
||||
* User: xgiovio
|
||||
@@ -93,4 +97,16 @@ package arraylist;
|
||||
|
||||
return to_return;
|
||||
}
|
||||
|
||||
@Override
|
||||
///////////////// implemented used a generic IndexListIterator
|
||||
public Iterator<E> iterator() {
|
||||
|
||||
E[] temp = (E[])new Object[this.size()];
|
||||
for (int i = 0 ;i < this.size(); i++){
|
||||
temp[i] = this.get(i);
|
||||
}
|
||||
return new IndexListIterator<E>(temp);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user