Merge remote-tracking branch 'remotes/origin/master' into ks-20191119-scheduler
This commit is contained in:
commit
9e4f57836f
|
@ -23,6 +23,7 @@ package ca.uhn.fhir.jpa.delete;
|
|||
import ca.uhn.fhir.jpa.util.DeleteConflict;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.hl7.fhir.instance.model.api.IIdType;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
@ -81,19 +82,30 @@ public class DeleteConflictList implements Iterable<DeleteConflict> {
|
|||
|
||||
private final int myOriginalRemoveModCont = myRemoveModCount;
|
||||
private int myNextIndex = 0;
|
||||
private boolean myLastOperationWasNext;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
checkForCoModification();
|
||||
myLastOperationWasNext = false;
|
||||
return myNextIndex < myList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeleteConflict next() {
|
||||
checkForCoModification();
|
||||
myLastOperationWasNext = true;
|
||||
return myList.get(myNextIndex++);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
Assert.isTrue(myLastOperationWasNext);
|
||||
myNextIndex--;
|
||||
myList.remove(myNextIndex);
|
||||
myLastOperationWasNext = false;
|
||||
}
|
||||
|
||||
private void checkForCoModification() {
|
||||
Validate.isTrue(myOriginalRemoveModCont == myRemoveModCount);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue