@Test public void testUpdateArrayColumnValues() { String updatedKey = "updatedKey"; Map<String, Object> previousColumns = ImmutableMap.of( SHARED_KEY, new byte[] {0x00, 0x01}, updatedKey, new byte[] {0x02, 0x03}); Map<String, Object> currentColumns = ImmutableMap.of( SHARED_KEY, new byte[] {0x00, 0x01}, updatedKey, new byte[] {0x04, 0x05}); assertEquals( ImmutableSet.of(updatedKey), Mutation.getUpdatedColumns(previousColumns, currentColumns)); }
protected static Set<String> getUpdatedColumns( final Map<String, ?> previousValues, final Map<String, ?> currentValues) { final Set<String> previousColumns = previousValues.keySet(); final Set<String> currentColumns = currentValues.keySet(); return ImmutableSet.<String>builder() .addAll(Sets.symmetricDifference(currentColumns, previousColumns)) .addAll( Sets.intersection(currentColumns, previousColumns) .stream() .filter( column -> !Objects.deepEquals(previousValues.get(column), currentValues.get(column))) .collect(Collectors.toSet())) .build(); }
Mutation { protected static Set<String> getUpdatedColumns( final Map<String, ?> previousValues, final Map<String, ?> currentValues) { final Set<String> previousColumns = previousValues.keySet(); final Set<String> currentColumns = currentValues.keySet(); return ImmutableSet.<String>builder() .addAll(Sets.symmetricDifference(currentColumns, previousColumns)) .addAll( Sets.intersection(currentColumns, previousColumns) .stream() .filter( column -> !Objects.deepEquals(previousValues.get(column), currentValues.get(column))) .collect(Collectors.toSet())) .build(); } }
Mutation { protected static Set<String> getUpdatedColumns( final Map<String, ?> previousValues, final Map<String, ?> currentValues) { final Set<String> previousColumns = previousValues.keySet(); final Set<String> currentColumns = currentValues.keySet(); return ImmutableSet.<String>builder() .addAll(Sets.symmetricDifference(currentColumns, previousColumns)) .addAll( Sets.intersection(currentColumns, previousColumns) .stream() .filter( column -> !Objects.deepEquals(previousValues.get(column), currentValues.get(column))) .collect(Collectors.toSet())) .build(); }  }
Mutation { protected static Set<String> getUpdatedColumns( final Map<String, ?> previousValues, final Map<String, ?> currentValues) { final Set<String> previousColumns = previousValues.keySet(); final Set<String> currentColumns = currentValues.keySet(); return ImmutableSet.<String>builder() .addAll(Sets.symmetricDifference(currentColumns, previousColumns)) .addAll( Sets.intersection(currentColumns, previousColumns) .stream() .filter( column -> !Objects.deepEquals(previousValues.get(column), currentValues.get(column))) .collect(Collectors.toSet())) .build(); }   }
Mutation { protected static Set<String> getUpdatedColumns( final Map<String, ?> previousValues, final Map<String, ?> currentValues) { final Set<String> previousColumns = previousValues.keySet(); final Set<String> currentColumns = currentValues.keySet(); return ImmutableSet.<String>builder() .addAll(Sets.symmetricDifference(currentColumns, previousColumns)) .addAll( Sets.intersection(currentColumns, previousColumns) .stream() .filter( column -> !Objects.deepEquals(previousValues.get(column), currentValues.get(column))) .collect(Collectors.toSet())) .build(); }    }