
com.upokecenter.mail.CollectionUtilities Maven / Gradle / Ivy
package com.upokecenter.mail;
/*
Written by Peter O. in 2014.
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
If you like this, you should donate to Peter O.
at: http://upokecenter.dreamhosters.com/articles/donate-now-2/
*/
import java.util.*;
final class CollectionUtilities {
private CollectionUtilities() {
}
public static boolean MapEquals(
Map mapA,
Map mapB) {
if (mapA == null) {
return mapB == null;
}
if (mapB == null) {
return false;
}
if (mapA.size() != mapB.size()) {
return false;
}
for (Map.Entry kvp : mapA.entrySet()) {
TValue valueB = null;
boolean hasKey;
valueB = mapB.get(kvp.getKey());
hasKey=(valueB == null) ? mapB.containsKey(kvp.getKey()) : true;
if (hasKey) {
TValue valueA = kvp.getValue();
if (!(((valueA) == null) ? ((valueB) == null) : (valueA).equals(valueB))) {
return false;
}
} else {
return false;
}
}
return true;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy