Skip to content

Commit

Permalink
remove code attempting to track deltas
Browse files Browse the repository at this point in the history
  • Loading branch information
jdereg committed Oct 8, 2023
1 parent 4ebdb6c commit 5bae739
Showing 1 changed file with 3 additions and 34 deletions.
37 changes: 3 additions & 34 deletions src/main/java/com/cedarsoftware/util/DeepEquals.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,27 +181,6 @@ public static boolean deepEquals(Object a, Object b, Map<String, ?> options)
return deepEquals(a, b, options, visited);
}

public static void dumpBreadCrumb(Set<ItemsToCompare> breadCrumbs)
{
Iterator<ItemsToCompare> 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<String, ?> options, Set<ItemsToCompare> visited)
{
Deque<ItemsToCompare> stack = new LinkedList<>();
Expand Down Expand Up @@ -494,12 +473,7 @@ private static boolean compareUnorderedCollection(Collection<?> col1, Collection
for (Object o : col2)
{
int hash = deepHashCode(o);
Collection<Object> items = fastLookup.get(hash);
if (items == null)
{
items = new ArrayList<>();
fastLookup.put(hash, items);
}
Collection<Object> items = fastLookup.computeIfAbsent(hash, k -> new ArrayList<>());
items.add(o);
}

Expand Down Expand Up @@ -556,12 +530,7 @@ private static boolean compareMap(Map<?, ?> map1, Map<?, ?> map2, Deque<ItemsToC
for (Map.Entry<?, ?> entry : map2.entrySet())
{
int hash = deepHashCode(entry.getKey());
Collection<Object> items = fastLookup.get(hash);
if (items == null)
{
items = new ArrayList<>();
fastLookup.put(hash, items);
}
Collection<Object> 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.
Expand Down Expand Up @@ -605,7 +574,7 @@ private static boolean compareMap(Map<?, ?> map1, Map<?, ?> map2, Deque<ItemsToC
}

/**
* @return true of the passed in o is within the passed in Collection, using a deepEquals comparison
* @return true if the passed in o is within the passed in Collection, using a deepEquals comparison
* element by element. Used only for hash collisions.
*/
private static boolean isContained(Object o, Collection<?> other, Set<ItemsToCompare> visited, Map<String, ?> options)
Expand Down

0 comments on commit 5bae739

Please sign in to comment.