forked from Speiger/Primitive-Collections
First draft of the 0.8.0 patch.
This commit is contained in:
parent
96458bd8b6
commit
efd29bbe7e
|
@ -1,6 +1,6 @@
|
||||||
# Changelog of versions
|
# Changelog of versions
|
||||||
|
|
||||||
### Version 0.8.0 (Unreleased)
|
### Version 0.8.0
|
||||||
- Added: ISizeProvider interface (Optimization Helper)
|
- Added: ISizeProvider interface (Optimization Helper)
|
||||||
- Added: ISizeProvider into most Iterable implementations (Distinct/Filter/FlatMap/ArrayFlatMap don't support it, for obvious reasons)
|
- 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.
|
- Added: ToArray function into Iterable which uses ISizeProvider to reduce overhead of duplicating arrays.
|
||||||
|
@ -11,6 +11,7 @@
|
||||||
- Added: Optimizations for HashUtils next power of function.
|
- Added: Optimizations for HashUtils next power of function.
|
||||||
- Added: toArray() now returns a cached empty array if the collection is empty.
|
- Added: toArray() now returns a cached empty array if the collection is empty.
|
||||||
- Added: toArray function for AsyncBuilder
|
- Added: toArray function for AsyncBuilder
|
||||||
|
- Added: Modularization to the library where feature can be disabled as needed. (Requires Self-Compilation)
|
||||||
- Fixed: putIfAbsent now replaces defaultValues
|
- Fixed: putIfAbsent now replaces defaultValues
|
||||||
- Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations.
|
- Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations.
|
||||||
- Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant.
|
- Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant.
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
### Extra Features
|
||||||
|
|
||||||
|
Primitive Collections comes with a few extra features that are disabled by default.
|
||||||
|
These will be enabled as soon they become relevant or never at all.
|
||||||
|
|
||||||
|
But some of these can be already unlocked when the target version changes.
|
||||||
|
|
||||||
|
If you compile the library for yourself you will automatically gain access to said features.
|
||||||
|
|
||||||
|
### Java17 Exclusive Features
|
||||||
|
Java17 has some new features that can sadly not really be back-ported but the library still supports them if it is compiled with java17
|
||||||
|
|
||||||
|
- RandomGenerator: Java17 has added [RandomGenerator.class](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/random/RandomGenerator.html).
|
||||||
|
This allows to use custom random implementations without having to re-implement them yourselves.
|
||||||
|
|
||||||
|
|
||||||
|
### ModuleSettings
|
||||||
|
Primitive Collections is a huge library.
|
||||||
|
But maybe you only use like 5-10 different classes.
|
||||||
|
Normally you would use tools like "Proguard" to get rid of classes that you don't use.
|
||||||
|
But since a lot of classes have dependencies on each other this would only do so much.
|
||||||
|
|
||||||
|
This is where the [ModuleSettings](ModuleSettings.json) come into play.
|
||||||
|
It allows you to turn of implementations as you wish and adjusts the code that everything still works.
|
||||||
|
|
||||||
|
There is 3 layers of control inside of the ModuleSettings.
|
||||||
|
- Modules directly at the top that turn off everything.
|
||||||
|
- Type Specific configurations, where you can for example turn of everything thats "Long" based.
|
||||||
|
- And then there is each type specific module settings.
|
||||||
|
|
||||||
|
Allowing for greater control without having to edit hundreds of lines of code.
|
||||||
|
On top of that:
|
||||||
|
Any Setting that isn't "Present" is counted as "Enabled".
|
||||||
|
So if you want to disable just 1 thing you can keep that 1 thing and delete the rest of the Setting.
|
||||||
|
It will still work as the same.
|
||||||
|
The default settings just come with everything so you can see what is controllable.
|
||||||
|
|
||||||
|
How to compile the Code with the ModuleSettings enabled:
|
||||||
|
```
|
||||||
|
/gradlew.bat generateLimitSource build -x test
|
||||||
|
```
|
10
README.md
10
README.md
|
@ -17,6 +17,10 @@ Benchmarks can be found here: [[Charts]](https://github.com/Speiger/Primitive-Co
|
||||||
[Here](features.md) you find a set of features added to Primitive Collections.
|
[Here](features.md) you find a set of features added to Primitive Collections.
|
||||||
These are designed to improve performance or to provide Quality of Life.
|
These are designed to improve performance or to provide Quality of Life.
|
||||||
|
|
||||||
|
[Here](EXTRAS.md) you also find features that can be used when you compile the library for yourself.
|
||||||
|
These features are not used by default to have a wider range of compat, or require self compilation.
|
||||||
|
Such as pruning classes that are not needed in your code.
|
||||||
|
|
||||||
## Main Features:
|
## Main Features:
|
||||||
- ArrayLists / LinkedLists / CopyOnWriteLists
|
- ArrayLists / LinkedLists / CopyOnWriteLists
|
||||||
- HashSets/Maps (Linked & HashControl)
|
- HashSets/Maps (Linked & HashControl)
|
||||||
|
@ -71,7 +75,11 @@ Please if you want to contribute follow the [Rule-Sheet](RuleSheet.md). It keeps
|
||||||
# How to Build
|
# How to Build
|
||||||
|
|
||||||
The SourceCode can be generated via:
|
The SourceCode can be generated via:
|
||||||
|
```
|
||||||
/gradlew.bat generateSource
|
/gradlew.bat generateSource
|
||||||
|
```
|
||||||
|
|
||||||
to generate SourceCode and build the jar:
|
to generate SourceCode and build the jar:
|
||||||
/gradlew.bat build
|
```
|
||||||
|
/gradlew.bat build
|
||||||
|
```
|
||||||
|
|
|
@ -83,6 +83,14 @@ task generateTestSource(type: JavaExec) {
|
||||||
args = ['tests', 'silent']
|
args = ['tests', 'silent']
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task generateLimitSource(type: JavaExec) {
|
||||||
|
group = 'internal'
|
||||||
|
description = 'Builds the Sourcecode with the ModuleSettings.json applied'
|
||||||
|
classpath = sourceSets.builder.runtimeClasspath
|
||||||
|
main = 'speiger.src.builder.PrimitiveCollectionsBuilder'
|
||||||
|
args = ['silent', 'load']
|
||||||
|
}
|
||||||
|
|
||||||
task javadocJar(type: Jar) {
|
task javadocJar(type: Jar) {
|
||||||
from javadoc
|
from javadoc
|
||||||
classifier = 'javadoc'
|
classifier = 'javadoc'
|
||||||
|
|
|
@ -782,6 +782,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
|
||||||
setResult(wrapper.TO_ARRAY());
|
setResult(wrapper.TO_ARRAY());
|
||||||
#endif
|
#endif
|
||||||
wrapper = null;
|
wrapper = null;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS;
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
||||||
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
#if !TYPE_BOOLEAN
|
#if !TYPE_BOOLEAN
|
||||||
import speiger.src.collections.utils.HashUtil;
|
import speiger.src.collections.utils.HashUtil;
|
||||||
|
@ -777,6 +778,8 @@ public class COLLECTIONS
|
||||||
@Override
|
@Override
|
||||||
public void forEach(Consumer<? super CLASS_TYPE> action) { synchronized(mutex) { c.forEach(action); } }
|
public void forEach(Consumer<? super CLASS_TYPE> action) { synchronized(mutex) { c.forEach(action); } }
|
||||||
#endif
|
#endif
|
||||||
|
@Override
|
||||||
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { synchronized(mutex) { c.forEachIndexed(action); } }
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() { synchronized(mutex) { return c.hashCode(); } }
|
public int hashCode() { synchronized(mutex) { return c.hashCode(); } }
|
||||||
@Override
|
@Override
|
||||||
|
@ -902,6 +905,8 @@ public class COLLECTIONS
|
||||||
@Override
|
@Override
|
||||||
public void forEach(Consumer<? super CLASS_TYPE> action) { c.forEach(action); }
|
public void forEach(Consumer<? super CLASS_TYPE> action) { c.forEach(action); }
|
||||||
#endif
|
#endif
|
||||||
|
@Override
|
||||||
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { c.forEachIndexed(action); }
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() { return c.hashCode(); }
|
public int hashCode() { return c.hashCode(); }
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue