Skip to content

Commit

Permalink
Updated the rewritable set impl to remove the original key to avoid h…
Browse files Browse the repository at this point in the history
…olding onto extra values (#2462)
  • Loading branch information
ivakegg committed Jul 9, 2024
1 parent bf0c84a commit 2d1451f
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ private boolean addResolvingCollisions(E e) {
// return true if this is a new element to the set
if (set.containsKey(e)) {
if ((rewriteStrategy != null) && rewriteStrategy.rewrite(set.get(e), e)) {
// let's remove to original key first to avoid holding on to extra values
set.remove(e);
set.put(e, e);
return true;
}
Expand Down

0 comments on commit 2d1451f

Please sign in to comment.