i have this situation:
Map<String, Object> origin = new HashMap<String, Object>();
origin.put("name", "client");
origin.put("website", "https://google.com");
origin.put("settings", new HashMap<String, Object>());
Map<String, Object> other = new HashMap<String, Object>();
other.put("id", "client");
other.put("name", "client");
other.put("website", "https://google.com");
other.put("settings", new HashMap<String, Object>());
if(Objects.equals(origin, other)) {
System.out.println("TRUE");
} else {
System.out.println("FALSE");
}
The result is false, because origin does not contain id.
origin is always a subset of other. Both Map can contains nested maps and lists.
Is there a smart java operation which checks if the values in origin are the same in other and give true back? Or do I had to iterate through the maps and compare each key?