Skip to content

Commit

Permalink
Make deepHashCode unique depending on order
Browse files Browse the repository at this point in the history
  • Loading branch information
MrNavaStar committed Feb 16, 2024
1 parent 55eccb0 commit b0b51fa
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/main/java/com/cedarsoftware/util/DeepEquals.java
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ public static int deepHashCode(Object obj)
Set<Object> visited = new HashSet<>();
LinkedList<Object> stack = new LinkedList<>();
stack.addFirst(obj);
int hash = 0;
int hash = 1;

while (!stack.isEmpty())
{
Expand Down Expand Up @@ -784,7 +784,7 @@ public static int deepHashCode(Object obj)

if (hasCustomHashCode(obj.getClass()))
{ // A real hashCode() method exists, call it.
hash += obj.hashCode();
hash = 31 * hash + obj.hashCode();
continue;
}

Expand Down

0 comments on commit b0b51fa

Please sign in to comment.