More fixes.
- Fixed: containsKey & containsValue in HashMaps were deprecated for Object Variants. - Fixed: HashMap wasn't deleting Keys & Values references when removing a Object - Fixed: AVLTreeMap didn't balance properly. - Changed: EnumMap no longer tries to access SharedSecrets since its gone in java11 - Added: HashMaps now implement ITrimmable - Added: AVLTreeSet didn't balance properly - Fixed: HashMaps & LinkedMaps weren't clearing references properly.
This commit is contained in:
@@ -549,6 +549,8 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
||||
else entry.parent.right = right;
|
||||
right.left = entry;
|
||||
entry.parent = right;
|
||||
entry.updateHeight();
|
||||
right.updateHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -564,6 +566,8 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
||||
else entry.parent.left = left;
|
||||
left.right = entry;
|
||||
entry.parent = left;
|
||||
entry.updateHeight();
|
||||
left.updateHeight();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1120,9 +1124,9 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
||||
|
||||
int getHeight() { return state; }
|
||||
|
||||
void updateHeight() { state = (1 + Math.max(left == null ? 0 : left.getHeight(), right == null ? 0 : right.getHeight())); }
|
||||
void updateHeight() { state = (1 + Math.max(left == null ? -1 : left.getHeight(), right == null ? -1 : right.getHeight())); }
|
||||
|
||||
int getBalance() { return (left == null ? 0 : left.getHeight()) - (right == null ? 0 : right.getBalance()); }
|
||||
int getBalance() { return (left == null ? -1 : left.getHeight()) - (right == null ? -1 : right.getHeight()); }
|
||||
|
||||
boolean needsSuccessor() { return left != null && right != null; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user