@@ -61,11 +61,11 @@ public boolean isEmpty() {
6161 public void applyPut (Put put , TableMetadata tableMetadata ) throws NoMutationException {
6262 ObjectStorageMutation mutation = new ObjectStorageMutation (put , tableMetadata );
6363 if (!put .getCondition ().isPresent ()) {
64- if (!records .containsKey (mutation .getRecordId ())) {
64+ ObjectStorageRecord existingRecord = records .get (mutation .getRecordId ());
65+ if (existingRecord == null ) {
6566 records .put (mutation .getRecordId (), mutation .makeRecord ());
6667 } else {
67- records .compute (
68- mutation .getRecordId (), (id , existingRecord ) -> mutation .makeRecord (existingRecord ));
68+ records .put (mutation .getRecordId (), mutation .makeRecord (existingRecord ));
6969 }
7070 } else if (put .getCondition ().get () instanceof PutIfNotExists ) {
7171 if (records .containsKey (mutation .getRecordId ())) {
@@ -74,12 +74,12 @@ public void applyPut(Put put, TableMetadata tableMetadata) throws NoMutationExce
7474 }
7575 records .put (mutation .getRecordId (), mutation .makeRecord ());
7676 } else if (put .getCondition ().get () instanceof PutIfExists ) {
77- if (!records .containsKey (mutation .getRecordId ())) {
77+ ObjectStorageRecord existingRecord = records .get (mutation .getRecordId ());
78+ if (existingRecord == null ) {
7879 throw new NoMutationException (
7980 CoreError .NO_MUTATION_APPLIED .buildMessage (), Collections .singletonList (put ));
8081 }
81- records .compute (
82- mutation .getRecordId (), (id , existingRecord ) -> mutation .makeRecord (existingRecord ));
82+ records .put (mutation .getRecordId (), mutation .makeRecord (existingRecord ));
8383 } else {
8484 assert put .getCondition ().get () instanceof PutIf ;
8585 if (!records .containsKey (mutation .getRecordId ())) {
0 commit comments