Skip to content

Instantly share code, notes, and snippets.

@tedpennings
Created December 5, 2011 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedpennings/1435060 to your computer and use it in GitHub Desktop.
Save tedpennings/1435060 to your computer and use it in GitHub Desktop.
When people call Java a noisy language, they are talking about the following
private boolean parameterListsConflict(Map<String, String> map1,
Map<String, String> map2) {
if (map1.equals(map2)) {
return true;
}
if (map1.size() > map2.size()) {
return largerMapContainsAllEntriesInSmallerMap(map1, map2);
} else {
return largerMapContainsAllEntriesInSmallerMap(map2, map1);
}
}
private boolean largerMapContainsAllEntriesInSmallerMap(
Map<String, String> larger, Map<String, String> smaller) {
Set<Entry<String, String>> largerEntrySet = larger.entrySet();
for (Entry<String, String> entry : smaller.entrySet()) {
if (!largerEntrySet.contains(entry)) {
return false;
}
}
return true;
}
private boolean groupsAndCategoriesMatch(Feature f1, Feature f2) {
return f1.getGroup().getKey().equals(f2.getGroup().getKey())
&& f1.getCategory().getKey().equals(f2.getCategory().getKey());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment