Could be also just:
```
if (lastEntry != null && !lastEntry.deleted) {
cacheIndex = 1;
}
```
This should work in general. I wonder if we could make it cleaner.
Although, the remove operation is not supposed to be called twice for the same
next,
if it happens and `lastEntry.deleted` is true, the problem will stay.
What if we cache always the previously returned value in `nextEntry()` as a
class field:
```
previousEntry = cacheEntries.get(cacheIndex);
```
then remove could be:
```
@Override
public void remove() {
if (previousEntry == null) {
throw new IllegalStateException("The remove
operation must be called after a valid next operation.");
}
if (!previousEntry.deleted) {
previousEntry.remove();
}
}
```
What do you think?
[ Full content available at: https://github.com/apache/flink/pull/6638 ]
This message was relayed via gitbox.apache.org for [email protected]