Started working on the next patch.

- Added: ISizeProvider interface (Optimization Helper)
- Added: ISizeProvider into most Iterable implementations
(Distinct/Filter/FlatMap/ArrayFlatMap don't support it, for obvious
reasons)
- Added: ToArray function into Iterable which uses ISizeProvider to
reduce overhead of duplicating arrays.
- Fixed: putIfAbsent now replaces defaultValues
This commit is contained in:
2022-11-20 08:56:23 +01:00
parent 5118ae8b1f
commit 99e9afe7b1
13 changed files with 197 additions and 10 deletions
@@ -280,7 +280,10 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
int compare = 0;
Node KEY_VALUE_GENERIC_TYPE parent = tree;
while(true) {
if((compare = compare(key, parent.key)) == 0) return parent.value;
if((compare = compare(key, parent.key)) == 0) {
if(VALUE_EQUALS(parent.value, getDefaultReturnValue())) return parent.setValue(value);
return parent.value;
}
if(compare < 0) {
if(parent.left == null) break;
parent = parent.left;