Created
April 7, 2011 11:29
-
-
Save anpieber/907606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean equals(Object obj) { | |
if (!(obj instanceof ConfigItem)) { | |
return false; | |
} | |
ConfigItem<?> toCompare = (ConfigItem<?>) obj; | |
if (!compareMetadata(toCompare.getMetaData(), metaData)) { | |
if (!compareMetadata(metaData, toCompare.getMetaData())) { | |
return false; | |
} | |
} | |
return true; | |
} | |
private boolean compareMetadata(Map<String, String> first, Map<String, String> second) { | |
Set<String> keys = first.keySet(); | |
for (String key : keys) { | |
if (!second.containsKey(key) || !second.get(key).equals(first.get(key))) { | |
return false; | |
} | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment