public AreasMapComparationResult findDifference(Map<Area, ColorModel> previous, Map<Area, ColorModel> current) { MapDifference<Area, ColorModel> differences = Maps.difference(previous, current); checkDifferencesCount(differences); if (isAdded(differences)) { return getAdded(differences); } if (isRemoved(differences)) { return getRemoved(differences); } if (isChanged(differences)) { return getChanged(differences); } return AreasMapComparationResult.ofSame(); }
@Test public void TestDiff() { HashMap<String, Object> map1 = new HashMap<>(); HashMap<String, Object> map2 = new HashMap<>(); map1.put("bbbb", "cccc"); map1.put("xxx", "aaa"); map2.put("xxx", "aa"); map2.put("cccc", "bbbb"); map1.put("dict", ImmutableMap.builder().put("a", 1).put("b", 2) .put("em", ImmutableMap.builder().put("c", 3).build()).build()); map2.put("dict", ImmutableMap.builder().put("a", 1).put("b", 3) .put("em", ImmutableMap.builder().put("c", 4).put("d", 5).build()).build()); MapDifference diff = Maps.difference(map1, map2); Map diffMap = new HashMap(); JsonCompareUtil.getDetailsDiff(map1, map2, diffMap, ""); Assert.assertTrue(diffMap.containsKey("bbbb")); Assert.assertTrue(diffMap.containsKey("xxx")); Assert.assertTrue(diffMap.containsKey("cccc")); Assert.assertTrue(diffMap.containsKey("dict.b")); Assert.assertTrue(diffMap.containsKey("dict.em.c")); Assert.assertTrue(diffMap.containsKey("dict.em.d")); Assert.assertEquals(6, diffMap.size()); }
private List<WebElement> findMatchedRows(List<RowWebElement> matchedRows, Map<String, String> rowToFind) { List<WebElement> resultedRows = new ArrayList<WebElement>(); for (RowWebElement rowCandidate : matchedRows) { Map<String, String> cellsCandidates = cellsFromRow(rowCandidate); MapDifference<String, String> diff = Maps.difference (cellsCandidates, rowToFind); if (diff.areEqual()) { resultedRows.add(rowCandidate.getRow()); } else if (diff.entriesOnlyOnRight().isEmpty() && diff .entriesDiffering().isEmpty()) { resultedRows.add(rowCandidate.getRow()); } else if (rowCandidate.hasSubRows()) { for (String commonKey : diff.entriesInCommon().keySet()) { rowToFind.remove(commonKey); } return findMatchedRows(getSubRowsFor(rowCandidate), diff .entriesOnlyOnRight().isEmpty() ? rowToFind : diff .entriesOnlyOnRight()); } } return resultedRows; }
private static JobDiff computeUnscoped( Map<Integer, ITaskConfig> currentState, IJobKey job, Map<Integer, ITaskConfig> proposedState) { requireNonNull(job); requireNonNull(proposedState); MapDifference<Integer, ITaskConfig> diff = Maps.difference(currentState, proposedState); Map<Integer, ITaskConfig> removedInstances = ImmutableMap.<Integer, ITaskConfig>builder() .putAll(diff.entriesOnlyOnLeft()) .putAll(Maps.transformValues(diff.entriesDiffering(), JobDiff.leftValue())) .build(); Set<Integer> addedInstances = ImmutableSet.<Integer>builder() .addAll(diff.entriesOnlyOnRight().keySet()) .addAll(diff.entriesDiffering().keySet()) .build(); return new JobDiff( removedInstances, addedInstances, ImmutableMap.copyOf(diff.entriesInCommon())); }
@Override public String get() { StringBuilder builder = new StringBuilder(); if (!difference.entriesDiffering().isEmpty()) { builder.append("Differing:\n"); for (Map.Entry<String, MapDifference.ValueDifference<SolrInputField>> diff : difference.entriesDiffering().entrySet()) { builder.append(" "); builder.append(diff.getKey()); builder.append('\n'); builder.append(" left : "); builder.append(diff.getValue().leftValue()); builder.append('\n'); builder.append(" right : "); builder.append(diff.getValue().rightValue()); builder.append('\n'); } } return builder.toString(); }
@Override protected boolean doEquivalent(SolrInputField o1, SolrInputField o2) { if (o1.getValue() instanceof SolrInputDocument) { if (!(o2.getValue() instanceof SolrInputDocument)) { return false; } final MapDifference<String, SolrInputField> difference = Maps.difference( (SolrInputDocument) o1.getValue(), (SolrInputDocument) o2.getValue(), this ); if (!difference.areEqual()) { return false; } } else { if (o1.getValue() != o2.getValue()) { return false; } } return true; }
private static Map<String, Long> calculateChanges(Map<String, Long> newCounts, Map<String, Long> currCounts) { Map<String, Long> changes = new HashMap<>(); // guava Maps class MapDifference<String, Long> diffs = Maps.difference(currCounts, newCounts); // compute the diffs for words that changed changes.putAll(Maps.transformValues(diffs.entriesDiffering(), vDiff -> vDiff.rightValue() - vDiff.leftValue())); // add all new words changes.putAll(diffs.entriesOnlyOnRight()); // subtract all words no longer present changes.putAll(Maps.transformValues(diffs.entriesOnlyOnLeft(), l -> l * -1)); return changes; }
protected void describeMismatchSafely(String prefix, MapDifference<TestHistoryDifferenceKey, Collection<TestHistoryDifferenceDescription>> difference, Description mismatchDescription) { appendIfNonEmpty(mismatchDescription, prefix, "missing: ", difference.entriesOnlyOnLeft()); appendIfNonEmpty(mismatchDescription, prefix, "unexpected: ", difference.entriesOnlyOnRight()); for (Entry<TestHistoryDifferenceKey, ValueDifference<Collection<TestHistoryDifferenceDescription>>> entryDiffering : difference.entriesDiffering().entrySet()) { mismatchDescription.appendText(prefix).appendText("differing from expected: ") .appendValue(entryDiffering.getKey()); ValueDifference<Collection<TestHistoryDifferenceDescription>> valueDifference = entryDiffering.getValue(); Collection<TestHistoryDifferenceDescription> expectedCollection = valueDifference.leftValue(); Collection<TestHistoryDifferenceDescription> actualCollection = valueDifference.rightValue(); String newPrefix = prefix + "\t\t"; if (expectedCollection.size() == 1 && actualCollection.size() == 1) { TestHistoryDifferenceDescription expected = Iterables.getOnlyElement(expectedCollection); TestHistoryDifferenceDescription actual = Iterables.getOnlyElement(actualCollection); describeMismatchSafely(newPrefix, expected, actual, mismatchDescription); } else { mismatchDescription.appendText(newPrefix).appendText("expected: ").appendValue(valueDifference.leftValue()); mismatchDescription.appendText(newPrefix).appendText("actual: ").appendValue(valueDifference.rightValue()); } } }
private boolean getDiff(String captureInstanceName, Map<String, Integer> sourceTableColumnInfo, Map<String, Integer> cdcTableColumnInfo) { MapDifference<String, Integer> diff = Maps.difference(sourceTableColumnInfo, cdcTableColumnInfo); if (!diff.areEqual()) { if (LOG.isTraceEnabled()) { LOG.trace( "Detected drift for table {} - new columns: {}, drop columns: {}", captureInstanceName, StringUtils.join(diff.entriesOnlyOnLeft().keySet(), ","), StringUtils.join(diff.entriesOnlyOnRight().keySet(), ",") ); } return true; } return false; }
public boolean compare(JSONObject expected, JSONObject actual) { MapDifference mapDifferences = Maps.difference(expected, actual); if (mapDifferences.entriesOnlyOnLeft().size() > 0) Assert.fail("Expected JSON has extra parameters: " + mapDifferences.entriesOnlyOnLeft()); if (mapDifferences.entriesOnlyOnRight().size() > 0) Assert.fail("Actual JSON has extra parameters: " + mapDifferences.entriesOnlyOnRight()); Map actualDifferences = new HashMap(); if (mapDifferences.entriesDiffering().size() > 0) { Map differences = Collections.unmodifiableMap(mapDifferences.entriesDiffering()); for (Object key : differences.keySet()) { Object expectedValueObject = expected.get(key); Object actualValueObject = actual.get(key); if (expectedValueObject instanceof Long || expectedValueObject instanceof Integer) { Long expectedValue = Long.parseLong(expectedValueObject.toString()); Long actualValue = Long.parseLong(actualValueObject.toString()); if (!expectedValue.equals(actualValue)) { actualDifferences.put(key, differences.get(key)); } } else { actualDifferences.put(key, differences.get(key)); } } } if (actualDifferences.size() > 0) Assert.fail("Expected and Actual JSON values don't match: " + actualDifferences); return true; }
private void processChanges(DefaultComparison comparison, DefaultComparison.DefaultSection section, Map<String, MapDifference.ValueDifference<Vector<Import>>> changes) { if (changes.size() > 0) { section.addSectionSummary(Comparison.SectionType.CONTENT_CHANGE, ComparatorConstants.CHANGED_IMPORTS); DefaultComparison.DefaultSection.DefaultTextChangeContent content = section.newTextChangeContent(); DefaultComparison.DefaultSection.DefaultTextChange change = section.newTextChange(); Vector<Import> left = new Vector<>(); Vector<Import> right = new Vector<>(); for (MapDifference.ValueDifference<Vector<Import>> diff : changes.values()) { left.add(diff.leftValue().firstElement()); right.add(diff.rightValue().firstElement()); } change.setOriginal(getImportsOnly(left)); change.setChanged(getImportsOnly(right)); content.setContent(change); section.addContent(Comparison.SectionType.CONTENT_CHANGE, content); } }
private boolean isDifferent(Map<String, Fault> left, Map<String, Fault> right) { if (left != null && right != null && left.size() != right.size()) { return true; } else { MapDifference<String, Fault> mapDiff = Maps.difference(left, right); if (!mapDiff.areEqual()) { return true; } else { for (String name : mapDiff.entriesInCommon().keySet()) { if (isDifferent(left.get(name), right.get(name))) { return true; } } } } return false; }
@Override public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName) { byte[] allData = Bytes.concat(partials); GameData.initializeServerGate(1); try { NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData); NBTTagList list = serverList.func_74761_m("List"); Set<ItemData> itemData = GameData.buildWorldItemData(list); GameData.validateWorldSave(itemData); MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation(); if (serverDifference!=null) { FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network); } } catch (IOException e) { } }
public static MapDifference<Integer, ItemData> gateWorldLoadingForValidation() { try { serverValidationLatch.await(); if (!isSaveValid) { return difference; } } catch (InterruptedException e) { } difference = null; return null; }
@Override public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName) { byte[] allData = Bytes.concat(partials); GameData.initializeServerGate(1); try { NBTTagCompound serverList = CompressedStreamTools.decompress(allData); NBTTagList list = serverList.getTagList("List"); Set<ItemData> itemData = GameData.buildWorldItemData(list); GameData.validateWorldSave(itemData); MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation(); if (serverDifference!=null) { FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network); } } catch (IOException e) { } }
@Override public String toString(){ ToStringHelper helper = Objects.toStringHelper(this) .add("id", getId()) .add("arguments", getArguments()); MapDifference<FieldName, ?> difference = getDifference(); if(difference != null){ helper.add("difference", getDifference()); } Exception exception = getException(); if(exception != null){ helper.add("exception", exception); } return helper.toString(); }
static void validateRegions(Map<String, Collection<String>> regionsToAdd, Map<String, Collection<String>> supportedRegions) { MapDifference<String, Collection<String>> comparison = Maps.difference(regionsToAdd, supportedRegions); checkArgument(comparison.entriesOnlyOnLeft().isEmpty(), "unsupported regions: %s", comparison .entriesOnlyOnLeft().keySet()); for (Entry<String, Collection<String>> entry : regionsToAdd.entrySet()) { ImmutableSet<String> toAdd = ImmutableSet.copyOf(entry.getValue()); SetView<String> intersection = Sets.intersection(toAdd, ImmutableSet.copyOf( supportedRegions.get(entry.getKey()))); SetView<String> unsupported = Sets.difference(toAdd, intersection); checkArgument(unsupported.isEmpty(), "unsupported territories in %s:", entry.getKey(), unsupported); } }
private static boolean roughlyEqual(String expectedRaw, String requestedPathRaw) { logger.debug("Comparing expected [{}] vs requested [{}]", expectedRaw, requestedPathRaw); if(StringUtils.isEmpty(expectedRaw)) { logger.debug("False: empty expected"); return false; } try { UriComponents expected = UriComponentsBuilder.fromUriString(expectedRaw).build(); UriComponents requested = UriComponentsBuilder.fromUriString(requestedPathRaw).build(); if(!Objects.equals(expected.getPath(), requested.getPath())) { logger.debug("False: expected path [{}] does not match requested path [{}]", expected.getPath(), requested.getPath()); return false; } MapDifference<String, List<String>> difference = Maps.difference(expected.getQueryParams(), requested.getQueryParams()); if(difference.entriesDiffering().size() != 0 || difference.entriesOnlyOnLeft().size() != 0 || difference.entriesOnlyOnRight().size() != 1 || difference.entriesOnlyOnRight().get(JWTSecurityService.JWT_PARAM_NAME) == null) { logger.debug("False: expected query params [{}] do not match requested query params [{}]", expected.getQueryParams(), requested.getQueryParams()); return false; } } catch(Exception e) { logger.warn("Exception encountered while comparing paths", e); return false; } return true; }
@Override public String get() { try (Writer w = new StringWriter()) { try (BufferedWriter writer = new BufferedWriter(w)) { writer.append(String.format("Map for actual.%s() does not match expected.%s().", this.method, this.method)); writer.newLine(); Map<?, ? extends MapDifference.ValueDifference<?>> differences = mapDifference.entriesDiffering(); if (!differences.isEmpty()) { writer.append("Keys with Differences"); writer.newLine(); for (Map.Entry<?, ? extends MapDifference.ValueDifference<?>> kvp : differences.entrySet()) { writer.append(" "); writer.append(kvp.getKey().toString()); writer.newLine(); writer.append(" expected:"); writer.append(kvp.getValue().leftValue().toString()); writer.newLine(); writer.append(" actual:"); writer.append(kvp.getValue().rightValue().toString()); writer.newLine(); } } Map<?, ?> entries = mapDifference.entriesOnlyOnLeft(); writeEntries(writer, "Only in expected map", entries); Map<?, ?> onlyInActual = mapDifference.entriesOnlyOnRight(); writeEntries(writer, "Only in actual map", onlyInActual); } return w.toString(); } catch (IOException ex) { throw new IllegalStateException(ex); } }
static void assertMap(Map<String, ?> expected, Map<String, ?> actual, String message) { if (null == expected && null == actual) { return; } String prefix = Strings.isNullOrEmpty(message) ? "" : message + ": "; assertNotNull(expected, prefix + "expected cannot be null"); assertNotNull(actual, prefix + "actual cannot be null"); MapDifference<String, ?> mapDifference = Maps.difference(expected, actual); assertTrue(mapDifference.areEqual(), new MapDifferenceSupplier(mapDifference, prefix)); }
public static void assertMap(Map<String, ?> expected, Map<String, ?> actual, String message) { if (null == expected && null == actual) { return; } String prefix = Strings.isNullOrEmpty(message) ? "" : message + ": "; assertNotNull(expected, prefix + "expected cannot be null"); assertNotNull(actual, prefix + "actual cannot be null"); MapDifference<String, ?> mapDifference = Maps.difference(expected, actual); assertTrue(mapDifference.areEqual(), new MapDifferenceSupplier(mapDifference, prefix)); }
private void handleTepIpsUpdateEvent(OpenvswitchOtherConfigs origLocalIps, OpenvswitchOtherConfigs updatedLocalIps, String nodeId) { Map<String, String> origLocalIpMap = Optional .ofNullable(bridgeMgr.getMultiValueMap(origLocalIps.getOtherConfigValue())) .orElse(Collections.emptyMap()); Map<String, String> updatedLocalIpMap = Optional .ofNullable(bridgeMgr.getMultiValueMap(updatedLocalIps.getOtherConfigValue())) .orElse(Collections.emptyMap()); MapDifference<String, String> mapDiff = Maps.difference(origLocalIpMap, updatedLocalIpMap); // Handling only underlay network updates for existing for TEP ips // Added and removed TEP ips will be handled by // TunnelStateChangeListener Map<String, ValueDifference<String>> entriesDiffering = mapDiff.entriesDiffering(); if (entriesDiffering == null || entriesDiffering.isEmpty()) { LOG.trace("No underlay network changes detected for for node {}", nodeId); return; } Optional<BigInteger> dpIdOpt = bridgeMgr.getDpIdFromManagerNodeId(nodeId); if (!dpIdOpt.isPresent()) { LOG.debug("Failed to get DPN id for node {}", nodeId); return; } BigInteger dpId = dpIdOpt.get(); for (Entry<String, ValueDifference<String>> entry : entriesDiffering.entrySet()) { String srcTepIp = entry.getKey(); ValueDifference<String> valueDiff = entry.getValue(); String origUnderlayNetwork = valueDiff.leftValue(); String updatedUnderlayNetwork = valueDiff.rightValue(); handleTepIpChangeEvent(dpId, srcTepIp, origUnderlayNetwork, updatedUnderlayNetwork); } }
/** * Because of an Ostrich bug the BaseQueueService methods have been copied to QueueService.java. * Verify that this copy has been done correctly and the 3 interfaces are identical. */ @Test public void testQueueApisMatch() { MapDifference<List<Object>, Method> diff = Maps.difference( getDeclaredPublicMethodMap(BaseQueueService.class), getDeclaredPublicMethodMap(QueueService.class)); assertTrue(diff.entriesOnlyOnLeft().isEmpty(), "In BaseQueueService but not in QueueService: " + diff.entriesOnlyOnLeft().values()); assertTrue(diff.entriesOnlyOnRight().isEmpty(), "In QueueService but not in BaseQueueService: " + diff.entriesOnlyOnRight().values()); }
/** * Because of an Ostrich bug the BaseQueueService methods have been copied to DedupQueueService.java. * Verify that this copy has been done correctly and the 3 interfaces are identical. */ @Test public void testDedupQueueApisMatch() { MapDifference<List<Object>, Method> diff = Maps.difference( getDeclaredPublicMethodMap(BaseQueueService.class), getDeclaredPublicMethodMap(DedupQueueService.class)); assertTrue(diff.entriesOnlyOnLeft().isEmpty(), "In BaseQueueService but not in DedupQueueService: " + diff.entriesOnlyOnLeft().values()); assertTrue(diff.entriesOnlyOnRight().isEmpty(), "In DedupQueueService but not in BaseQueueService: " + diff.entriesOnlyOnRight().values()); }
FetchResult(ImmutableMap<String, GitRevision> before, ImmutableMap<String, GitRevision> after) { MapDifference<String, GitRevision> diff = Maps.difference(before, after); deleted = ImmutableMap.copyOf(diff.entriesOnlyOnLeft()); inserted = ImmutableMap.copyOf(diff.entriesOnlyOnRight()); updated = ImmutableMap.copyOf(diff.entriesDiffering().entrySet().stream() .collect(Collectors.toMap( Map.Entry::getKey, v -> new RefUpdate(v.getValue().leftValue(), v.getValue().rightValue())))); }
private Set<String> computeChangedFiles() { Map<String, String> pathToContent = readAllFiles(changesBase); Map<String, String> previousContent = previousPath == null ? ImmutableMap.of() : readAllFiles(previousPath); MapDifference<String, String> diff = Maps.difference(pathToContent, previousContent); return ImmutableSet.<String>builder() .addAll(diff.entriesOnlyOnLeft().keySet()) .addAll(diff.entriesOnlyOnRight().keySet()) .addAll(diff.entriesDiffering().keySet()) .build(); }
@Override public void updatingValues(TransactionBase tx, Iterator<org.apache.fluo.recipes.core.map.Update<String, Long>> updates) { TypedTransactionBase ttx = tl.wrap(tx); Map<String, Long> expectedOld = new HashMap<>(); while (updates.hasNext()) { org.apache.fluo.recipes.core.map.Update<String, Long> update = updates.next(); if (update.getOldValue().isPresent()) { expectedOld.put("side:" + update.getKey(), update.getOldValue().get()); } ttx.mutate().row("side:" + update.getKey()).col(DSCOL).set(update.getNewValue().get()); } // get last values set to verify same as passed in old value Map<String, Long> actualOld = Maps.transformValues( ttx.get().rowsString(expectedOld.keySet()).columns(ImmutableSet.of(DSCOL)).toStringMap(), m -> m.get(DSCOL).toLong()); MapDifference<String, Long> diff = Maps.difference(expectedOld, actualOld); Assert.assertTrue(diff.toString(), diff.areEqual()); globalUpdates.incrementAndGet(); }
public Map<String, ValueDifference<String>> getPreferenceChanges() { Map<String, String> currentSettings = Maps.newHashMapWithExpectedSize(keys.length); for (String key : keys) { currentSettings.put(key, preferenceStore.getString(key)); } MapDifference<String, String> mapDifference = Maps.difference(currentSettings, originalSettings); Map<String, ValueDifference<String>> entriesDiffering = mapDifference.entriesDiffering(); return entriesDiffering; }
@Override public boolean equals(final Object other) { if (other instanceof ParametersWrapperBase && other.getClass() == this.getClass()) { ParametersWrapperBase<?> pw = (ParametersWrapperBase<?>)other; Map<String,String> otherParams = pw.getParams(); MapDifference<String,String> diff = Maps.difference(_params,otherParams); return diff.entriesInCommon().size() == _params.size() && diff.entriesInCommon().size() == otherParams.size(); } return false; }
private static MapDifference<String, IndexMetadata> indexesDiff(Indexes before, Indexes after) { Map<String, IndexMetadata> beforeMap = new HashMap<>(); before.forEach(i -> beforeMap.put(i.name, i)); Map<String, IndexMetadata> afterMap = new HashMap<>(); after.forEach(i -> afterMap.put(i.name, i)); return Maps.difference(beforeMap, afterMap); }
private static MapDifference<String, TriggerMetadata> triggersDiff(Triggers before, Triggers after) { Map<String, TriggerMetadata> beforeMap = new HashMap<>(); before.forEach(t -> beforeMap.put(t.name, t)); Map<String, TriggerMetadata> afterMap = new HashMap<>(); after.forEach(t -> afterMap.put(t.name, t)); return Maps.difference(beforeMap, afterMap); }
public final boolean equalsTuple(Object oo, boolean print) { if (oo != null && oo instanceof MapTuple) { MapTuple t = (MapTuple)oo; MapDifference<String, Object> diff = Maps.difference(t._values, this._values); if (diff.areEqual()) { return true; } else { if (print) { System.err.println(diff); } } } return false; }
static <K, V> void assertMapsEqual( Map<K, V> expected, Map<K, V> result, Equivalence<V> valueEquivalence) { MapDifference<K, V> difference = Maps.difference(expected, result, valueEquivalence); if (!difference.areEqual()) { StringBuilder builder = new StringBuilder(); builder.append("Maps differ. "); builder.append("Entries differing: ").append(difference.entriesDiffering()).append("\n"); builder.append("Missing entries: ").append(difference.entriesOnlyOnLeft()).append("\n"); builder.append("Extra entries: ").append(difference.entriesOnlyOnRight()).append("\n"); fail(builder.toString()); } }
@Test public void entries_only_on_left() { MapDifference<Integer, Student> mapDifference = Maps.difference( geometryClass, gymClass); Map<Integer, Student> studentsOnLeft = mapDifference .entriesOnlyOnLeft(); logger.info(studentsOnLeft); assertThat(studentsOnLeft, hasKey(new Integer(456))); assertThat(studentsOnLeft, hasKey(new Integer(912))); }
@Test public void entries_only_on_right() { MapDifference<Integer, Student> mapDifference = Maps.difference( geometryClass, gymClass); Map<Integer, Student> studentsOnTheRight = mapDifference .entriesOnlyOnRight(); logger.info(studentsOnTheRight); assertThat(studentsOnTheRight, hasKey(new Integer(478))); assertThat(studentsOnTheRight, hasKey(new Integer(937))); }
public void saveSheet(SheetData sheetData, Collection<SheetData.Property> properties) { if (properties != null && properties.contains(SheetData.Property.aliases)) { // check which alias changed // make a diff between the stored version of aliases and the new list MapDifference<Alias, AreaReference> diff = Maps.difference(previousAliases, sheetData.getAliases()); previousAliases = new HashMap<Alias, AreaReference>(sheetData.getAliases()); workbookAliasDependencyManager.refreshAliases(sheet.getName(), diff.entriesDiffering().keySet(), diff .entriesOnlyOnLeft().keySet()); } }