org.seekay.contract.model.tools.MapTools Maven / Gradle / Ivy
The newest version!
package org.seekay.contract.model.tools;
import java.util.Map;
public class MapTools {
/**
* Private constructor for utility class
*/
private MapTools() {
throw new IllegalStateException("Utility classes should never be constructed");
}
public static boolean isSubMap(Map subMap, Map superMap) {
if(subMap == null || subMap.isEmpty()) {
return true;
}
for(Map.Entry subMapEntry : subMap.entrySet()) {
if(!containsEntry(subMapEntry, superMap)) {
return false;
}
}
return true;
}
public static boolean containsEntry(Map.Entry entry, Map map) {
return map.containsKey(entry.getKey()) && map.get(entry.getKey()).equals(entry.getValue());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy