Make sure to set last bucket to null after remove or you could have a memory leak

This commit is contained in:
Sam Harwell 2012-12-14 13:08:25 -06:00
parent 4e1473a6f0
commit 01893f9678
1 changed files with 1 additions and 0 deletions

View File

@ -260,6 +260,7 @@ public class Array2DHashSet<T> implements Set<T> {
// shift all elements to the right down one
// for (int j=i; j<bucket.length-1; j++) bucket[j] = bucket[j+1];
System.arraycopy(bucket, i+1, bucket, i, bucket.length-i-1);
bucket[bucket.length - 1] = null;
n--;
return true;
}