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
@@ -102,6 +102,26 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
*/
public VALUE_TYPE put(KEY_TYPE key, VALUE_TYPE value);
/**
* A Helper method that allows to put int a MAP.Entry into a map.
* @param entry then Entry that should be inserted.
* @return the last present value or default return value.
*/
public default VALUE_TYPE put(Entry KEY_VALUE_GENERIC_TYPE entry) {
return put(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
}
#if !TYPE_OBJECT || !VALUE_OBJECT
/**
* A Helper method that allows to put int a Map.Entry into a map.
* @param entry then Entry that should be inserted.
* @return the last present value or default return value.
*/
public default CLASS_VALUE_TYPE put(Map.Entry<CLASS_TYPE, CLASS_VALUE_TYPE> entry) {
return put(entry.getKey(), entry.getValue());
}
#endif
/**
* Type Specific array method to bulk add elements into a map without creating a wrapper and increasing performances
* @param keys the keys that should be added