Diff { public static List<Diff> of(Object before, Object after) { List<Diff> diffs = new ArrayList<>(); Map<String, Object> beforeMap = FastBeanCopier.copy(before, HashMap::new); Map<String, Object> afterMap = FastBeanCopier.copy(after, HashMap::new); for (Map.Entry<String, Object> entry : afterMap.entrySet()) { Object afterValue = entry.getValue(); String key = entry.getKey(); Object beforeValue = beforeMap.get(key); if (!CompareUtils.compare(beforeValue, afterValue)) { diffs.add(new Diff(key, beforeValue, afterValue)); } } return diffs; }  static List<Diff> of(Object before, Object after); @Override String toString();  }
@Test public void mapTest() { Map<String, Object> before = new HashMap<>(); before.put("name", "name"); before.put("age",21); before.put("bool", true); before.put("bool", false); before.put("birthday", DateFormatter.fromString("19910101")); Map<String, Object> after = new HashMap<>(); after.put("name", "name"); after.put("age", "21"); after.put("bool", "true"); after.put("bool", "false"); after.put("birthday", "1991-01-01"); List<Diff> diffs = Diff.of(before, after); System.out.println(diffs); Assert.assertTrue(diffs.isEmpty()); }