New Features

- Added: addOrGet for sets.
- Added: Async API which allows to easily execute Iterables/Collections
offthread without the complexity.
This commit is contained in:
2022-04-07 00:04:52 +02:00
parent 29c4d253cf
commit 6f31fc5abb
15 changed files with 1168 additions and 1 deletions
@@ -132,6 +132,17 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
return false;
}
#if TYPE_OBJECT
@Override
public KEY_TYPE addOrGet(KEY_TYPE o) {
int index = findIndex(o);
if(index != -1) return data[index];
if(data.length == size) data = Arrays.copyOf(data, size == 0 ? 2 : size * 2);
data[size++] = o;
return o;
}
#endif
@Override
public boolean addAndMoveToFirst(KEY_TYPE o) {
int index = findIndex(o);