From 5bae739e774cc38167cc8911b119e01fd5412d81 Mon Sep 17 00:00:00 2001 From: John DeRegnaucourt Date: Sun, 8 Oct 2023 16:27:12 -0400 Subject: [PATCH] remove code attempting to track deltas --- .../com/cedarsoftware/util/DeepEquals.java | 37 ++----------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/src/main/java/com/cedarsoftware/util/DeepEquals.java b/src/main/java/com/cedarsoftware/util/DeepEquals.java index ce09c430..d9d520ee 100644 --- a/src/main/java/com/cedarsoftware/util/DeepEquals.java +++ b/src/main/java/com/cedarsoftware/util/DeepEquals.java @@ -181,27 +181,6 @@ public static boolean deepEquals(Object a, Object b, Map options) return deepEquals(a, b, options, visited); } - public static void dumpBreadCrumb(Set breadCrumbs) - { - Iterator i = breadCrumbs.iterator(); - int space = 0; - while (i.hasNext()) - { - ItemsToCompare compare = i.next(); - whitespace(space); - System.out.println(compare.toString()); - space += 2; - } - } - - private static void whitespace(int x) - { - for (int i=0; i < x; i++) - { - System.out.print(' '); - } - } - private static boolean deepEquals(Object a, Object b, Map options, Set visited) { Deque stack = new LinkedList<>(); @@ -494,12 +473,7 @@ private static boolean compareUnorderedCollection(Collection col1, Collection for (Object o : col2) { int hash = deepHashCode(o); - Collection items = fastLookup.get(hash); - if (items == null) - { - items = new ArrayList<>(); - fastLookup.put(hash, items); - } + Collection items = fastLookup.computeIfAbsent(hash, k -> new ArrayList<>()); items.add(o); } @@ -556,12 +530,7 @@ private static boolean compareMap(Map map1, Map map2, Deque entry : map2.entrySet()) { int hash = deepHashCode(entry.getKey()); - Collection items = fastLookup.get(hash); - if (items == null) - { - items = new ArrayList<>(); - fastLookup.put(hash, items); - } + Collection items = fastLookup.computeIfAbsent(hash, k -> new ArrayList<>()); // Use only key and value, not specific Map.Entry type for equality check. // This ensures that Maps that might use different Map.Entry types still compare correctly. @@ -605,7 +574,7 @@ private static boolean compareMap(Map map1, Map map2, Deque other, Set visited, Map options)