Hey
Wisst ihr, wo hier der Fehler ist?
Wisst ihr, wo hier der Fehler ist?
Code:
public Iterator<T> iterator() {
Iterator<T> it = new Iterator<T>() {
private int cuurentIndex = 0;
private int cuurentSize = list.size() - 1;
@Override
public boolean hasNext() {
return cuurentIndex < cuurentSize && list.get(cuurentIndex) != null;
}
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
return list.get(cuurentIndex++);
}
};
return it;
}