Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3bff703d91 | ||
|
|
d140aaa788 | ||
|
|
180b603ffd | ||
|
|
2306917b10 | ||
|
|
075f3ad183 | ||
|
|
363160441d |
@@ -1,5 +1,23 @@
|
|||||||
# Changelog of versions
|
# Changelog of versions
|
||||||
|
|
||||||
|
### Version 1.0.1
|
||||||
|
-Added: AsyncBuilder now supports CompletableFuture
|
||||||
|
-Added: forEach(BiConsumer, Input)
|
||||||
|
|
||||||
|
|
||||||
|
### Version 1.0.0
|
||||||
|
-Added: Sequenced Collections support.
|
||||||
|
-Added: ReferenceMaps
|
||||||
|
-Added: IndirectSorting
|
||||||
|
-Added: Missing Optionals
|
||||||
|
-Added: Collectors for Lists and Sets
|
||||||
|
-Added: ReverseCollections for Sequenced/OrderedCollections
|
||||||
|
-Breaking Change: FindFirst & reduce without identity use now Optionals instead of defaultValues
|
||||||
|
-Breaking Change: Lists and OrderedSets no longer use Poll prefix they use now the java Remove
|
||||||
|
-Fixed: #33
|
||||||
|
-Fixed: Add/PutAndMoveToFirst wouldn't work if the collection was only with 1 entry present.
|
||||||
|
-Fixed: Various new bugs found with the expansion of the unit tests.
|
||||||
|
|
||||||
### Version 0.9.0
|
### Version 0.9.0
|
||||||
- Added: getFirst/getLast/removeFirst/removeLast to List.class.
|
- Added: getFirst/getLast/removeFirst/removeLast to List.class.
|
||||||
- Added: Dedicated Set toArray implementations.
|
- Added: Dedicated Set toArray implementations.
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ Such as pruning classes that are not needed in your code.
|
|||||||
- HashSets/Maps (Linked & HashControl)
|
- HashSets/Maps (Linked & HashControl)
|
||||||
- TreeSets/Maps (RB & AVL)
|
- TreeSets/Maps (RB & AVL)
|
||||||
- EnumMaps
|
- EnumMaps
|
||||||
|
- ReferenceMaps (Weak Keys)
|
||||||
- Immutable Maps/Lists/Sets
|
- Immutable Maps/Lists/Sets
|
||||||
- ConcurrentHashMaps
|
- ConcurrentHashMaps
|
||||||
- Priority Queues
|
- Priority Queues
|
||||||
@@ -51,14 +52,14 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.github.Speiger:Primitive-Collections:0.9.0'
|
implementation 'com.github.Speiger:Primitive-Collections:1.0.0'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Using Maven Central
|
Using Maven Central
|
||||||
```groovy
|
```groovy
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'io.github.speiger:Primitive-Collections:0.9.0'
|
implementation 'io.github.speiger:Primitive-Collections:1.0.0'
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+47
-47
@@ -1,7 +1,7 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id 'java-library'
|
||||||
id "jacoco"
|
id "jacoco"
|
||||||
id "com.vanniktech.maven.publish" version "0.28.0"
|
// id "com.vanniktech.maven.publish" version "0.28.0"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
@@ -332,49 +332,49 @@ tasks.withType(PublishToMavenLocal) {
|
|||||||
//Maven central Start
|
//Maven central Start
|
||||||
//Disabling due to java8 incompat, only needed to manually publishing anyways
|
//Disabling due to java8 incompat, only needed to manually publishing anyways
|
||||||
|
|
||||||
signing.useGpgCmd()
|
//signing.useGpgCmd()
|
||||||
|
//
|
||||||
import com.vanniktech.maven.publish.SonatypeHost
|
//import com.vanniktech.maven.publish.SonatypeHost
|
||||||
import com.vanniktech.maven.publish.JavaLibrary
|
//import com.vanniktech.maven.publish.JavaLibrary
|
||||||
import com.vanniktech.maven.publish.JavadocJar
|
//import com.vanniktech.maven.publish.JavadocJar
|
||||||
|
//
|
||||||
mavenPublishing {
|
//mavenPublishing {
|
||||||
configure(new JavaLibrary(new JavadocJar.None(), true))
|
// configure(new JavaLibrary(new JavadocJar.None(), true))
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
mavenPublishing {
|
//mavenPublishing {
|
||||||
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
// publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
||||||
|
//
|
||||||
signAllPublications()
|
// signAllPublications()
|
||||||
pom {
|
// pom {
|
||||||
name = 'Primitive Collections'
|
// name = 'Primitive Collections'
|
||||||
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
// description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
||||||
url = 'https://github.com/Speiger/Primitive-Collections'
|
// url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
version = project.version
|
// version = project.version
|
||||||
group = 'io.github.speiger'
|
// group = 'io.github.speiger'
|
||||||
licenses {
|
// licenses {
|
||||||
license {
|
// license {
|
||||||
name = 'The Apache License, Version 2.0'
|
// name = 'The Apache License, Version 2.0'
|
||||||
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
// url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
developers {
|
// developers {
|
||||||
developer {
|
// developer {
|
||||||
id = 'speiger'
|
// id = 'speiger'
|
||||||
name = 'Speiger'
|
// name = 'Speiger'
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
scm {
|
// scm {
|
||||||
connection = 'scm:git:git://github.com/Speiger/Primitive-Collections.git'
|
// connection = 'scm:git:git://github.com/Speiger/Primitive-Collections.git'
|
||||||
developerConnection = 'scm:git:ssh://github.com:Speiger/Primitive-Collections.git'
|
// developerConnection = 'scm:git:ssh://github.com:Speiger/Primitive-Collections.git'
|
||||||
url = 'https://github.com/Speiger/Primitive-Collections'
|
// url = 'https://github.com/Speiger/Primitive-Collections'
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
issueManagement {
|
// issueManagement {
|
||||||
system = 'github'
|
// system = 'github'
|
||||||
url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
// url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|||||||
+1
-1
@@ -3,4 +3,4 @@ org.gradle.jvmargs=-Xmx3G
|
|||||||
maxMemory = 2048m
|
maxMemory = 2048m
|
||||||
testThreads = 4
|
testThreads = 4
|
||||||
|
|
||||||
RELEASE_VERSION = 1.0.0
|
RELEASE_VERSION = 1.0.1
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package speiger.src.builder;
|
package speiger.src.builder;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public enum RequiredType
|
public enum RequiredType
|
||||||
{
|
{
|
||||||
BI_CLASS,
|
BI_CLASS,
|
||||||
ENUM
|
ENUM
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,123 +1,124 @@
|
|||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.RequiredType;
|
import speiger.src.builder.RequiredType;
|
||||||
import speiger.src.builder.dependencies.IDependency;
|
import speiger.src.builder.dependencies.IDependency;
|
||||||
import speiger.src.builder.dependencies.ModuleDependency;
|
import speiger.src.builder.dependencies.ModuleDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class FunctionModule extends BaseModule
|
public class FunctionModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new FunctionModule();
|
public static final BaseModule INSTANCE = new FunctionModule();
|
||||||
public static final ModuleDependency MODULE = new ModuleDependency(INSTANCE, false).addKeyDependency(JavaModule.MODULE);
|
public static final ModuleDependency MODULE = new ModuleDependency(INSTANCE, false).addKeyDependency(JavaModule.MODULE);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Function"; }
|
public String getModuleName() { return "Function"; }
|
||||||
@Override
|
@Override
|
||||||
public boolean isBiModule() { return true; }
|
public boolean isBiModule() { return true; }
|
||||||
@Override
|
@Override
|
||||||
protected void loadVariables() {}
|
protected void loadVariables() {}
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {}
|
protected void loadFlags() {}
|
||||||
@Override
|
@Override
|
||||||
protected void loadTestClasses() {}
|
protected void loadTestClasses() {}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) {
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) {
|
||||||
return Arrays.asList(MODULE);
|
return Arrays.asList(MODULE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades()
|
protected void loadBlockades()
|
||||||
{
|
{
|
||||||
if(keyType.isObject()) addBlockedFiles("Consumer", "Comparator");
|
if(keyType.isObject()) addBlockedFiles("Consumer", "Comparator");
|
||||||
if(!MODULE.isEnabled()) addBlockedFiles("Consumer", "BiConsumer", "Comparator", "Supplier", "Optional", "Function", "UnaryOperator");
|
if(!MODULE.isEnabled()) addBlockedFiles("Consumer", "BiConsumer", "Comparator", "Supplier", "Optional", "Function", "UnaryOperator");
|
||||||
if(!keyType.needsCustomJDKType()) addBlockedFiles("Optional");
|
if(!keyType.needsCustomJDKType()) addBlockedFiles("Optional");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadRemappers()
|
protected void loadRemappers()
|
||||||
{
|
{
|
||||||
addBiRequirement("BiConsumer", "");
|
addBiRequirement("BiConsumer", "");
|
||||||
addBiRequirement("UnaryOperator", "");
|
addBiRequirement("UnaryOperator", "");
|
||||||
if(valueType == ClassType.BOOLEAN) {
|
if(valueType == ClassType.BOOLEAN) {
|
||||||
addRequirement("Function", "%1$s", RequiredType.BI_CLASS);
|
addRequirement("Function", "%1$s", RequiredType.BI_CLASS);
|
||||||
addRemapper("Function", (keyType.isObject() ? "" : "%s")+"Predicate");
|
addRemapper("Function", (keyType.isObject() ? "" : "%s")+"Predicate");
|
||||||
}
|
}
|
||||||
else if(keyType.isObject() && !valueType.isObject()) {
|
else if(keyType.isObject() && !valueType.isObject()) {
|
||||||
addRequirement("Function", "%2$s", RequiredType.BI_CLASS);
|
addRequirement("Function", "%2$s", RequiredType.BI_CLASS);
|
||||||
addRemapper("Function", "To%sFunction");
|
addRemapper("Function", "To%sFunction");
|
||||||
}
|
}
|
||||||
else if(keyType == valueType) {
|
else if(keyType == valueType) {
|
||||||
addRequirement("Function", "%1$s", RequiredType.BI_CLASS);
|
addRequirement("Function", "%1$s", RequiredType.BI_CLASS);
|
||||||
addRemapper("Function", (keyType.isObject() ? "" : "%s")+"UnaryOperator");
|
addRemapper("Function", (keyType.isObject() ? "" : "%s")+"UnaryOperator");
|
||||||
}
|
}
|
||||||
else if(valueType.isObject()) {
|
else if(valueType.isObject()) {
|
||||||
addRequirement("Function", "%1$s", RequiredType.BI_CLASS);
|
addRequirement("Function", "%1$s", RequiredType.BI_CLASS);
|
||||||
addRemapper("Function", "%sFunction");
|
addRemapper("Function", "%sFunction");
|
||||||
}
|
}
|
||||||
else addBiRequirement("Function");
|
else addBiRequirement("Function");
|
||||||
addRemapper("BiConsumer", "%sConsumer");
|
addRemapper("BiConsumer", "%sConsumer");
|
||||||
addRemapper("Optional", "Optional%s");
|
addRemapper("Optional", "Optional%s");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFunctions()
|
protected void loadFunctions()
|
||||||
{
|
{
|
||||||
addSimpleMapper("APPLY", keyType.getApply(valueType));
|
addSimpleMapper("APPLY", keyType.getApply(valueType));
|
||||||
addSimpleMapper("SUPPLY_GET", keyType.isObject() ? "get" : "getAs"+keyType.getNonFileType());
|
addSimpleMapper("SUPPLY_GET", keyType.isObject() ? "get" : "getAs"+keyType.getNonFileType());
|
||||||
addSimpleMapper("VALUE_SUPPLY_GET", valueType.isObject() ? "get" : "getAs"+valueType.getNonFileType());
|
addSimpleMapper("VALUE_SUPPLY_GET", valueType.isObject() ? "get" : "getAs"+valueType.getNonFileType());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadClasses()
|
protected void loadClasses()
|
||||||
{
|
{
|
||||||
//Interfaces
|
//Interfaces
|
||||||
addBiClassMapper("BI_CONSUMER", "Consumer", "");
|
addBiClassMapper("BI_CONSUMER", "Consumer", "");
|
||||||
addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer");
|
addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer");
|
||||||
addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer");
|
addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer");
|
||||||
addAbstractMapper("BI_FROM_INT_CONSUMER", "Int%sConsumer");
|
addAbstractMapper("BI_TO_OBJECT_CONSUMER", "%sObjectConsumer");
|
||||||
if(keyType.isObject()) {
|
addAbstractMapper("BI_FROM_INT_CONSUMER", "Int%sConsumer");
|
||||||
addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"UnaryOperator");
|
if(keyType.isObject()) {
|
||||||
addSimpleMapper("VALUE_TO_OBJECT_FUNCTION", valueType.isObject() ? "UnaryOperator" : valueType.getFileType()+"Function");
|
addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"UnaryOperator");
|
||||||
}
|
addSimpleMapper("VALUE_TO_OBJECT_FUNCTION", valueType.isObject() ? "UnaryOperator" : valueType.getFileType()+"Function");
|
||||||
else {
|
}
|
||||||
addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"Function");
|
else {
|
||||||
addSimpleMapper("VALUE_TO_OBJECT_FUNCTION", valueType.isObject() ? "UnaryOperator" : valueType.getFileType()+"Function");
|
addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"Function");
|
||||||
}
|
addSimpleMapper("VALUE_TO_OBJECT_FUNCTION", valueType.isObject() ? "UnaryOperator" : valueType.getFileType()+"Function");
|
||||||
if(valueType == ClassType.BOOLEAN) addFunctionMappers("FUNCTION", "%sPredicate");
|
}
|
||||||
else if(keyType.isObject() && !valueType.isObject()) addFunctionValueMappers("FUNCTION", "To%sFunction");
|
if(valueType == ClassType.BOOLEAN) addFunctionMappers("FUNCTION", "%sPredicate");
|
||||||
else if(keyType == valueType) addFunctionMappers("FUNCTION", "%sUnaryOperator");
|
else if(keyType.isObject() && !valueType.isObject()) addFunctionValueMappers("FUNCTION", "To%sFunction");
|
||||||
else if(valueType.isObject()) addFunctionMappers("FUNCTION", "%sFunction");
|
else if(keyType == valueType) addFunctionMappers("FUNCTION", "%sUnaryOperator");
|
||||||
else addBiClassMapper("FUNCTION", "Function", "2");
|
else if(valueType.isObject()) addFunctionMappers("FUNCTION", "%sFunction");
|
||||||
|
else addBiClassMapper("FUNCTION", "Function", "2");
|
||||||
addFunctionMappers("PREDICATE", "%sPredicate");
|
|
||||||
addClassMapper("SUPPLIER", "Supplier");
|
addFunctionMappers("PREDICATE", "%sPredicate");
|
||||||
addSimpleMapper("OPTIONAL", keyType.isObject() ? "Optional" : String.format("Optional%s", keyType.getFileType()));
|
addClassMapper("SUPPLIER", "Supplier");
|
||||||
addSimpleMapper("VALUE_OPTIONAL", valueType.isObject() ? "Optional" : String.format("Optional%s", valueType.getFileType()));
|
addSimpleMapper("OPTIONAL", keyType.isObject() ? "Optional" : String.format("Optional%s", keyType.getFileType()));
|
||||||
addAbstractMapper("SINGLE_UNARY_OPERATOR", "%1$s%1$sUnaryOperator");
|
addSimpleMapper("VALUE_OPTIONAL", valueType.isObject() ? "Optional" : String.format("Optional%s", valueType.getFileType()));
|
||||||
addBiClassMapper("UNARY_OPERATOR", "UnaryOperator", "");
|
addAbstractMapper("SINGLE_UNARY_OPERATOR", "%1$s%1$sUnaryOperator");
|
||||||
if(keyType.isObject())
|
addBiClassMapper("UNARY_OPERATOR", "UnaryOperator", "");
|
||||||
{
|
if(keyType.isObject())
|
||||||
if(!valueType.isObject()) addSimpleMapper("VALUE_CONSUMER", valueType.getFileType()+"Consumer");
|
{
|
||||||
else addSimpleMapper("VALUE_CONSUMER", "Consumer");
|
if(!valueType.isObject()) addSimpleMapper("VALUE_CONSUMER", valueType.getFileType()+"Consumer");
|
||||||
addSimpleMapper("CONSUMER", "Consumer");
|
else addSimpleMapper("VALUE_CONSUMER", "Consumer");
|
||||||
addSimpleMapper("IARRAY", "IObjectArray");
|
addSimpleMapper("CONSUMER", "Consumer");
|
||||||
}
|
addSimpleMapper("IARRAY", "IObjectArray");
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
if(valueType.isObject())
|
{
|
||||||
{
|
if(valueType.isObject())
|
||||||
addSimpleMapper("VALUE_CONSUMER", "Consumer");
|
{
|
||||||
addSimpleMapper("CONSUMER", keyType.getFileType()+"Consumer");
|
addSimpleMapper("VALUE_CONSUMER", "Consumer");
|
||||||
}
|
addSimpleMapper("CONSUMER", keyType.getFileType()+"Consumer");
|
||||||
else addClassMapper("CONSUMER", "Consumer");
|
}
|
||||||
addFunctionMappers("IARRAY", "I%sArray");
|
else addClassMapper("CONSUMER", "Consumer");
|
||||||
}
|
addFunctionMappers("IARRAY", "I%sArray");
|
||||||
addSimpleMapper("VALUE_COMPARATOR", valueType.isObject() ? "Comparator" : String.format("%sComparator", valueType.getNonFileType()));
|
}
|
||||||
addSimpleMapper("COMPARATOR", keyType.isObject() ? "Comparator" : String.format("%sComparator", keyType.getNonFileType()));
|
addSimpleMapper("VALUE_COMPARATOR", valueType.isObject() ? "Comparator" : String.format("%sComparator", valueType.getNonFileType()));
|
||||||
}
|
addSimpleMapper("COMPARATOR", keyType.isObject() ? "Comparator" : String.format("%sComparator", keyType.getNonFileType()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+15
@@ -39,6 +39,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
|
import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -153,6 +156,18 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
|
|||||||
iterator().forEachRemaining(input, action);
|
iterator().forEachRemaining(input, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
||||||
|
* @param action The action to be performed for each element
|
||||||
|
* @param input the object that should be included
|
||||||
|
* @param <E> the generic type of the Object
|
||||||
|
* @throws java.lang.NullPointerException if the specified action is null
|
||||||
|
*/
|
||||||
|
default <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
iterator().forEachRemaining(action, input);
|
||||||
|
}
|
||||||
|
|
||||||
#if SPLIT_ITERATOR_FEATURE
|
#if SPLIT_ITERATOR_FEATURE
|
||||||
/**
|
/**
|
||||||
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
||||||
|
|||||||
+107
-92
@@ -1,93 +1,108 @@
|
|||||||
package speiger.src.collections.PACKAGE.collections;
|
package speiger.src.collections.PACKAGE.collections;
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !TYPE_OBJECT
|
||||||
/**
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
* A Type-Specific {@link Iterator} that reduces (un)boxing
|
#endif
|
||||||
* @Type(T)
|
|
||||||
*/
|
/**
|
||||||
public interface ITERATOR KEY_GENERIC_TYPE extends Iterator<CLASS_TYPE>
|
* A Type-Specific {@link Iterator} that reduces (un)boxing
|
||||||
{
|
* @Type(T)
|
||||||
#if !TYPE_OBJECT
|
*/
|
||||||
/**
|
public interface ITERATOR KEY_GENERIC_TYPE extends Iterator<CLASS_TYPE>
|
||||||
* Returns the next element in the iteration.
|
{
|
||||||
*
|
#if !TYPE_OBJECT
|
||||||
* @return the next element in the iteration
|
/**
|
||||||
* @throws java.util.NoSuchElementException if the iteration has no more elements
|
* Returns the next element in the iteration.
|
||||||
* @see Iterator#next()
|
*
|
||||||
*/
|
* @return the next element in the iteration
|
||||||
public KEY_TYPE NEXT();
|
* @throws java.util.NoSuchElementException if the iteration has no more elements
|
||||||
|
* @see Iterator#next()
|
||||||
/** {@inheritDoc}
|
*/
|
||||||
* <p>This default implementation delegates to the corresponding type-specific function.
|
public KEY_TYPE NEXT();
|
||||||
* @deprecated Please use the corresponding type-specific function instead.
|
|
||||||
*/
|
/** {@inheritDoc}
|
||||||
@Override
|
* <p>This default implementation delegates to the corresponding type-specific function.
|
||||||
@Deprecated
|
* @deprecated Please use the corresponding type-specific function instead.
|
||||||
public default CLASS_TYPE next() { return KEY_TO_OBJ(NEXT()); }
|
*/
|
||||||
|
@Override
|
||||||
/**
|
@Deprecated
|
||||||
* Performs the given action for each remaining element until all elements
|
public default CLASS_TYPE next() { return KEY_TO_OBJ(NEXT()); }
|
||||||
* have been processed or the action throws an exception. Actions are
|
|
||||||
* performed in the order of iteration, if that order is specified.
|
/**
|
||||||
* Exceptions thrown by the action are relayed to the caller.
|
* Performs the given action for each remaining element until all elements
|
||||||
*
|
* have been processed or the action throws an exception. Actions are
|
||||||
* @implSpec
|
* performed in the order of iteration, if that order is specified.
|
||||||
* <p>The default implementation behaves as if:
|
* Exceptions thrown by the action are relayed to the caller.
|
||||||
* <pre>{@code
|
*
|
||||||
* while (hasNext()) action.accept(NEXT());
|
* @implSpec
|
||||||
* }</pre>
|
* <p>The default implementation behaves as if:
|
||||||
*
|
* <pre>{@code
|
||||||
* @param action The action to be performed for each element
|
* while (hasNext()) action.accept(NEXT());
|
||||||
* @throws java.lang.NullPointerException if the specified action is null
|
* }</pre>
|
||||||
* @see Iterator#forEachRemaining(Consumer)
|
*
|
||||||
*/
|
* @param action The action to be performed for each element
|
||||||
public default void forEachRemaining(CONSUMER action) {
|
* @throws java.lang.NullPointerException if the specified action is null
|
||||||
Objects.requireNonNull(action);
|
* @see Iterator#forEachRemaining(Consumer)
|
||||||
while(hasNext()) { action.accept(NEXT()); }
|
*/
|
||||||
}
|
public default void forEachRemaining(CONSUMER action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
/** {@inheritDoc}
|
while(hasNext()) { action.accept(NEXT()); }
|
||||||
* <p>This default implementation delegates to the corresponding type-specific function.
|
}
|
||||||
* @deprecated Please use the corresponding type-specific function instead.
|
|
||||||
*/
|
/** {@inheritDoc}
|
||||||
@Deprecated
|
* <p>This default implementation delegates to the corresponding type-specific function.
|
||||||
@Override
|
* @deprecated Please use the corresponding type-specific function instead.
|
||||||
default void forEachRemaining(Consumer<? super CLASS_TYPE> action) {
|
*/
|
||||||
Objects.requireNonNull(action);
|
@Deprecated
|
||||||
forEachRemaining(action::accept);
|
@Override
|
||||||
}
|
default void forEachRemaining(Consumer<? super CLASS_TYPE> action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
#endif
|
forEachRemaining(action::accept);
|
||||||
/**
|
}
|
||||||
* Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
|
||||||
* @param input the object that should be included
|
#endif
|
||||||
* @param action The action to be performed for each element
|
/**
|
||||||
* @param <E> the generic type of the Object
|
* Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
||||||
* @throws java.lang.NullPointerException if the specified action is null
|
* @param input the object that should be included
|
||||||
*/
|
* @param action The action to be performed for each element
|
||||||
default <E> void forEachRemaining(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
|
* @param <E> the generic type of the Object
|
||||||
Objects.requireNonNull(action);
|
* @throws java.lang.NullPointerException if the specified action is null
|
||||||
while(hasNext()) { action.accept(input, NEXT()); }
|
*/
|
||||||
}
|
default <E> void forEachRemaining(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
/**
|
while(hasNext()) { action.accept(input, NEXT()); }
|
||||||
* Skips the Given amount of elements if possible. A Optimization function to skip elements faster if the implementation allows it.
|
}
|
||||||
* @param amount the amount of elements that should be skipped
|
|
||||||
* @return the amount of elements that were skipped
|
/**
|
||||||
*/
|
* Helper function to reduce Lambda usage and allow for more method references, since these are faster/cleaner.
|
||||||
default int skip(int amount) {
|
* @param action The action to be performed for each element
|
||||||
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
* @param input the object that should be included
|
||||||
int i = 0;
|
* @param <E> the generic type of the Object
|
||||||
for(;i<amount && hasNext();NEXT(), i++);
|
* @throws java.lang.NullPointerException if the specified action is null
|
||||||
return i;
|
*/
|
||||||
}
|
default <E> void forEachRemaining(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
while(hasNext()) { action.accept(NEXT(), input); }
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Skips the Given amount of elements if possible. A Optimization function to skip elements faster if the implementation allows it.
|
||||||
|
* @param amount the amount of elements that should be skipped
|
||||||
|
* @return the amount of elements that were skipped
|
||||||
|
*/
|
||||||
|
default int skip(int amount) {
|
||||||
|
if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed");
|
||||||
|
int i = 0;
|
||||||
|
for(;i<amount && hasNext();NEXT(), i++);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+19
-1
@@ -50,7 +50,11 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -700,7 +704,21 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
|
|||||||
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
|
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
for(int i = 0;i<size;i++)
|
for(int i = 0;i<size;i++)
|
||||||
action.accept(input, data[i]);
|
action.accept(input, data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
action.accept(data[i], input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
action.accept(i, data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
+20
@@ -49,7 +49,11 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -826,6 +830,22 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
|
|||||||
action.accept(input, data[i]);
|
action.accept(input, data[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
KEY_TYPE[] data = this.data;
|
||||||
|
for(int i = 0,m=data.length;i<m;i++)
|
||||||
|
action.accept(data[i], input);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
KEY_TYPE[] data = this.data;
|
||||||
|
for(int i = 0,m=data.length;i<m;i++)
|
||||||
|
action.accept(i, data[i]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+654
-636
File diff suppressed because it is too large
Load Diff
@@ -47,6 +47,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -512,6 +515,13 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
|
|||||||
action.accept(input, entry.value);
|
action.accept(input, entry.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next)
|
||||||
|
action.accept(entry.value, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+67
-2
@@ -25,15 +25,20 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
@@ -82,6 +87,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_OPTIONAL;
|
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_OPTIONAL;
|
||||||
@@ -758,6 +766,25 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
|
long stamp = seg.readLock();
|
||||||
|
try {
|
||||||
|
int index = seg.firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(new ValueMapEntry(index, i), input);
|
||||||
|
index = (int)seg.links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
seg.unlockRead(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1087,6 +1114,25 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
|
long stamp = seg.readLock();
|
||||||
|
try {
|
||||||
|
int index = seg.firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(seg.keys[index], input);
|
||||||
|
index = (int)seg.links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
seg.unlockRead(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1355,6 +1401,25 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0,m=segments.length;i<m;i++) {
|
||||||
|
Segment KEY_VALUE_GENERIC_TYPE seg = segments[i];
|
||||||
|
long stamp = seg.readLock();
|
||||||
|
try {
|
||||||
|
int index = seg.firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(seg.values[index], input);
|
||||||
|
index = (int)seg.links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
seg.unlockRead(stamp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+43
-2
@@ -21,9 +21,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
@@ -33,7 +38,7 @@ import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUME
|
|||||||
import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
||||||
@@ -60,6 +65,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
@@ -827,6 +835,17 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(new ValueMapEntry(index), input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1108,6 +1127,17 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(keys[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1291,6 +1321,17 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(values[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+40
-3
@@ -22,15 +22,20 @@ import java.util.VALUE_OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
@@ -77,7 +82,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !SAME_TYPE
|
#if !SAME_TYPE
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
@@ -1030,6 +1037,16 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(new ValueMapEntry(nullIndex), input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(new ValueMapEntry(i), input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1277,6 +1294,16 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(keys[nullIndex], input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(keys[i], input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1443,6 +1470,16 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(values[nullIndex], input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(values[i], input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+43
-3
@@ -21,9 +21,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
@@ -33,7 +38,7 @@ import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUME
|
|||||||
import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR;
|
||||||
@@ -58,7 +63,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !SAME_TYPE
|
#if !SAME_TYPE
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
@@ -831,6 +838,17 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(new ValueMapEntry(index), input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1110,6 +1128,17 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(keys[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1295,6 +1324,17 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(values[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+40
-3
@@ -22,15 +22,20 @@ import java.util.VALUE_OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
@@ -76,7 +81,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_OPTIONAL;
|
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_OPTIONAL;
|
||||||
@@ -989,6 +996,16 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(new ValueMapEntry(nullIndex), input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(new ValueMapEntry(i), input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1232,6 +1249,16 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(keys[nullIndex], input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(keys[i], input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1398,6 +1425,16 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(values[nullIndex], input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(values[i], input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+43
-2
@@ -21,9 +21,14 @@ import java.util.VALUE_OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
@@ -35,7 +40,7 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
@@ -82,6 +87,9 @@ import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_CONSUMER;
|
|||||||
import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR;
|
import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR;
|
||||||
import speiger.src.collections.VALUE_PACKAGE.utils.VALUE_ARRAYS;
|
import speiger.src.collections.VALUE_PACKAGE.utils.VALUE_ARRAYS;
|
||||||
#endif
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
@@ -739,6 +747,17 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(new BasicEntryKV_BRACES(keys[index], values[index]), input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -990,6 +1009,17 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(keys[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1166,6 +1196,17 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1){
|
||||||
|
action.accept(values[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+36
-3
@@ -21,9 +21,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
@@ -35,7 +40,7 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
@@ -66,9 +71,12 @@ import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR;
|
|||||||
import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE
|
#if !SAME_TYPE
|
||||||
#if VALUE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
@@ -972,6 +980,13 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
|||||||
action.accept(input, new ValueMapEntry(i));
|
action.accept(input, new ValueMapEntry(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;i++) {
|
||||||
|
action.accept(new ValueMapEntry(i), input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
@@ -1181,6 +1196,12 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
|||||||
for(int i = 0;i<size;action.accept(input, keys[i++]));
|
for(int i = 0;i<size;action.accept(input, keys[i++]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;action.accept(keys[i++], input));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1323,6 +1344,18 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
|||||||
for(int i = 0;i<size;action.accept(i, values[i++]));
|
for(int i = 0;i<size;action.accept(i, values[i++]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE<E> action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;action.accept(input, values[i++]));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;action.accept(values[i++], input));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+38
-2
@@ -26,9 +26,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
|||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
@@ -37,7 +42,7 @@ import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUME
|
|||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
|
import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_OBJECT && !JDK_TYPE
|
#if !TYPE_OBJECT && !JDK_TYPE
|
||||||
@@ -76,6 +81,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
@@ -1284,6 +1292,13 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
action.accept(input, entry.key);
|
action.accept(input, entry.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
|
||||||
|
action.accept(entry.key, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1986,6 +2001,13 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
|
||||||
|
action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -2126,6 +2148,13 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
action.accept(input, entry.value);
|
action.accept(input, entry.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
|
||||||
|
action.accept(entry.value, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -2647,6 +2676,13 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
|
|||||||
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
|
||||||
|
action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+45
-3
@@ -25,9 +25,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
|||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
#if !TYPE_INT || !SAME_TYPE
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
||||||
#if !TYPE_OBJECT && !VALUE_OBJECT
|
#endif
|
||||||
|
#if !TYPE_OBJECT && !VALUE_OBJECT && !TYPE_INT
|
||||||
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
import speiger.src.collections.ints.functions.consumer.IntObjectConsumer;
|
||||||
#endif
|
#endif
|
||||||
#if !SAME_TYPE && !TYPE_INT
|
#if !SAME_TYPE && !TYPE_INT
|
||||||
@@ -36,7 +41,7 @@ import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUME
|
|||||||
#if !VALUE_BOOLEAN || !JDK_TYPE
|
#if !VALUE_BOOLEAN || !JDK_TYPE
|
||||||
import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
|
import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_INT || !SAME_TYPE
|
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !TYPE_OBJECT && !JDK_TYPE
|
#if !TYPE_OBJECT && !JDK_TYPE
|
||||||
@@ -74,7 +79,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
|
|||||||
#if !SAME_TYPE
|
#if !SAME_TYPE
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
|
#if !VALUE_OBJECT && !VALUE_INT
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
#if !JDK_VALUE
|
#if !JDK_VALUE
|
||||||
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
|
||||||
@@ -1340,6 +1347,13 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
action.accept(input, entry.key);
|
action.accept(input, entry.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
|
||||||
|
action.accept(entry.key, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -2052,6 +2066,13 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
|
||||||
|
action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -2192,6 +2213,13 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
action.accept(input, entry.value);
|
action.accept(input, entry.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
|
||||||
|
action.accept(entry.value, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -2548,6 +2576,13 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
action.accept(input, entry.value);
|
action.accept(input, entry.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(VALUE_BI_TO_OBJECT_CONSUMER VVS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
|
||||||
|
action.accept(entry.value, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -2713,6 +2748,13 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
|
|||||||
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(ObjectObjectConsumer<MAP.Entry KEY_VALUE_GENERIC_TYPE, E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
|
||||||
|
action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -425,6 +428,13 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
action.accept(input, entry.key);
|
action.accept(input, entry.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
|
||||||
|
action.accept(entry.key, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1311,6 +1321,13 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
action.accept(input, entry.key);
|
action.accept(input, entry.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry))
|
||||||
|
action.accept(entry.key, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+768
-758
File diff suppressed because it is too large
Load Diff
+13
@@ -27,6 +27,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -363,6 +366,16 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(keys[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+13
@@ -37,6 +37,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -683,6 +686,16 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(keys[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+13
@@ -35,6 +35,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -538,6 +541,16 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
int index = firstIndex;
|
||||||
|
while(index != -1) {
|
||||||
|
action.accept(keys[index], input);
|
||||||
|
index = (int)links[index];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+13
@@ -34,6 +34,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -622,6 +625,16 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(keys[nullIndex], input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(keys[i], input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
@@ -34,6 +34,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -485,6 +488,16 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
if(size() <= 0) return;
|
||||||
|
if(containsNull) action.accept(keys[nullIndex], input);
|
||||||
|
for(int i = nullIndex-1;i>=0;i--) {
|
||||||
|
if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(keys[i], input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
|
|||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
|
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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !JDK_FUNCTION
|
#if !JDK_FUNCTION
|
||||||
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
||||||
#endif
|
#endif
|
||||||
@@ -424,6 +427,13 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
action.accept(input, entry.key);
|
action.accept(input, entry.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
|
||||||
|
action.accept(entry.key, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
@@ -1371,6 +1381,13 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
|
|||||||
action.accept(input, entry.key);
|
action.accept(input, entry.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry))
|
||||||
|
action.accept(entry.key, input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
|
||||||
Objects.requireNonNull(filter);
|
Objects.requireNonNull(filter);
|
||||||
|
|||||||
+1109
-1083
File diff suppressed because it is too large
Load Diff
+25
-4
@@ -46,6 +46,9 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
|
|||||||
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.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_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_TO_OBJECT_CONSUMER;
|
||||||
|
#endif
|
||||||
#if !TYPE_BOOLEAN
|
#if !TYPE_BOOLEAN
|
||||||
import speiger.src.collections.utils.HashUtil;
|
import speiger.src.collections.utils.HashUtil;
|
||||||
#endif
|
#endif
|
||||||
@@ -294,6 +297,13 @@ public class COLLECTIONS
|
|||||||
action.accept(elements[i]);
|
action.accept(elements[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
action.accept(i, elements[i]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
|
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
|
||||||
Objects.requireNonNull(action);
|
Objects.requireNonNull(action);
|
||||||
@@ -301,6 +311,13 @@ public class COLLECTIONS
|
|||||||
action.accept(input, elements[i]);
|
action.accept(input, elements[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) {
|
||||||
|
Objects.requireNonNull(action);
|
||||||
|
for(int i = 0;i<size;i++)
|
||||||
|
action.accept(elements[i], input);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean trim(int size) {
|
public boolean trim(int size) {
|
||||||
if(size > size() || size() == elements.length) return false;
|
if(size > size() || size() == elements.length) return false;
|
||||||
@@ -855,6 +872,10 @@ public class COLLECTIONS
|
|||||||
@Override
|
@Override
|
||||||
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { synchronized(mutex) { c.forEachIndexed(action); } }
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { synchronized(mutex) { c.forEachIndexed(action); } }
|
||||||
@Override
|
@Override
|
||||||
|
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) { synchronized(mutex) { c.forEach(input, action); } }
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) { synchronized(mutex) { c.forEach(action, input); } }
|
||||||
|
@Override
|
||||||
public int hashCode() { synchronized(mutex) { return c.hashCode(); } }
|
public int hashCode() { synchronized(mutex) { return c.hashCode(); } }
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
@@ -864,8 +885,6 @@ public class COLLECTIONS
|
|||||||
@Override
|
@Override
|
||||||
public String toString() { synchronized(mutex) { return c.toString(); } }
|
public String toString() { synchronized(mutex) { return c.toString(); } }
|
||||||
@Override
|
@Override
|
||||||
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) { synchronized(mutex) { c.forEach(input, action); } }
|
|
||||||
@Override
|
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return c.matchesAny(filter); } }
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return c.matchesAny(filter); } }
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return c.matchesNone(filter); } }
|
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return c.matchesNone(filter); } }
|
||||||
@@ -1010,14 +1029,16 @@ public class COLLECTIONS
|
|||||||
@Override
|
@Override
|
||||||
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { c.forEachIndexed(action); }
|
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { c.forEachIndexed(action); }
|
||||||
@Override
|
@Override
|
||||||
|
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) { c.forEach(input, action); }
|
||||||
|
@Override
|
||||||
|
public <E> void forEach(BI_TO_OBJECT_CONSUMER KKS_GENERIC_TYPE<E> action, E input) { c.forEach(action, input); }
|
||||||
|
@Override
|
||||||
public int hashCode() { return c.hashCode(); }
|
public int hashCode() { return c.hashCode(); }
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) { return obj == this || c.equals(obj); }
|
public boolean equals(Object obj) { return obj == this || c.equals(obj); }
|
||||||
@Override
|
@Override
|
||||||
public String toString() { return c.toString(); }
|
public String toString() { return c.toString(); }
|
||||||
@Override
|
@Override
|
||||||
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) { c.forEach(input, action); }
|
|
||||||
@Override
|
|
||||||
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { return c.matchesAny(filter); }
|
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { return c.matchesAny(filter); }
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { return c.matchesNone(filter); }
|
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { return c.matchesNone(filter); }
|
||||||
|
|||||||
+18
@@ -44,6 +44,15 @@ public class FILE_KEY_TYPECollectionForEachTester KEY_GENERIC_TYPE extends ABSTR
|
|||||||
HELPERS.assertContentsAnyOrder(elements, createSamplesArray());
|
HELPERS.assertContentsAnyOrder(elements, createSamplesArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ignore
|
||||||
|
@CollectionFeature.Require(absent = KNOWN_ORDER)
|
||||||
|
public void testForEachExtraUnknownOrderReverse() {
|
||||||
|
#endignore
|
||||||
|
LIST KEY_GENERIC_TYPE elements = new ARRAY_LISTBRACES();
|
||||||
|
collection.forEach((K, V) -> V.add(K), elements);
|
||||||
|
HELPERS.assertContentsAnyOrder(elements, createSamplesArray());
|
||||||
|
}
|
||||||
|
|
||||||
#ignore
|
#ignore
|
||||||
@CollectionFeature.Require(KNOWN_ORDER)
|
@CollectionFeature.Require(KNOWN_ORDER)
|
||||||
public void testForEachKnownOrder() {
|
public void testForEachKnownOrder() {
|
||||||
@@ -70,4 +79,13 @@ public class FILE_KEY_TYPECollectionForEachTester KEY_GENERIC_TYPE extends ABSTR
|
|||||||
collection.forEach(elements, LIST::add);
|
collection.forEach(elements, LIST::add);
|
||||||
assertEquals("Different ordered iteration", HELPERS.copyToList(getOrderedElements()), elements);
|
assertEquals("Different ordered iteration", HELPERS.copyToList(getOrderedElements()), elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ignore
|
||||||
|
@CollectionFeature.Require(KNOWN_ORDER)
|
||||||
|
public void testForEachExtraKnownOrderReverse() {
|
||||||
|
#endignore
|
||||||
|
LIST KEY_GENERIC_TYPE elements = new ARRAY_LISTBRACES();
|
||||||
|
collection.forEach((K, V) -> V.add(K), elements);
|
||||||
|
assertEquals("Different ordered iteration", HELPERS.copyToList(getOrderedElements()), elements);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
package speiger.src.collections.utils;
|
package speiger.src.collections.utils;
|
||||||
|
|
||||||
import java.util.RandomAccess;
|
import java.util.RandomAccess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Helper interface that allows to detect if the Underlying implementation is
|
* A Helper interface that allows to detect if the Underlying implementation is
|
||||||
* using a Array. This allows to read methods through synchronization layers.
|
* using a Array. This allows to read methods through synchronization layers.
|
||||||
* Also it implements {@link RandomAccess} and {@link ITrimmable}
|
* Also it implements {@link RandomAccess} and {@link ITrimmable}
|
||||||
*/
|
*/
|
||||||
public interface IArray extends RandomAccess, ITrimmable
|
public interface IArray extends RandomAccess, ITrimmable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Increases the capacity of this implementation instance, if necessary,
|
* Increases the capacity of this implementation instance, if necessary,
|
||||||
* to ensure that it can hold at least the number of elements specified by
|
* to ensure that it can hold at least the number of elements specified by
|
||||||
* the minimum capacity argument.
|
* the minimum capacity argument.
|
||||||
*
|
*
|
||||||
* @param size the desired minimum capacity
|
* @param size the desired minimum capacity
|
||||||
*/
|
*/
|
||||||
public void ensureCapacity(int size);
|
public void ensureCapacity(int size);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,178 +1,178 @@
|
|||||||
package speiger.src.collections.utils;
|
package speiger.src.collections.utils;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.concurrent.ForkJoinPool;
|
import java.util.concurrent.ForkJoinPool;
|
||||||
import java.util.concurrent.ForkJoinTask;
|
import java.util.concurrent.ForkJoinTask;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper class that provides functions that are shared within the library.
|
* Helper class that provides functions that are shared within the library.
|
||||||
* On top of that it provides some helper functions that allow control of some internals of the Library
|
* On top of that it provides some helper functions that allow control of some internals of the Library
|
||||||
*/
|
*/
|
||||||
public class SanityChecks
|
public class SanityChecks
|
||||||
{
|
{
|
||||||
/** Max Possible ArraySize without the JVM Crashing */
|
/** Max Possible ArraySize without the JVM Crashing */
|
||||||
public static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
|
public static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
|
||||||
private static ForkJoinPool WORK_POOL = ForkJoinPool.commonPool();
|
private static ForkJoinPool WORK_POOL = ForkJoinPool.commonPool();
|
||||||
private static boolean FORCE_IGNORE_PARALLELISM = false;
|
private static boolean FORCE_IGNORE_PARALLELISM = false;
|
||||||
private static ThreadLocal<Random> RANDOM = ThreadLocal.withInitial(Random::new);
|
private static ThreadLocal<Random> RANDOM = ThreadLocal.withInitial(Random::new);
|
||||||
private static ThreadLocal<Boolean> FORCE_ASYNC = ThreadLocal.withInitial(() -> false);
|
private static ThreadLocal<Boolean> FORCE_ASYNC = ThreadLocal.withInitial(() -> false);
|
||||||
private static ThreadLocal<Boolean> FORCE_TASK_POOL = ThreadLocal.withInitial(() -> false);
|
private static ThreadLocal<Boolean> FORCE_TASK_POOL = ThreadLocal.withInitial(() -> false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function to cast a Integer to a Byte
|
* Internal function to cast a Integer to a Byte
|
||||||
* @param value that should be turned into a byte
|
* @param value that should be turned into a byte
|
||||||
* @return the value as a byte
|
* @return the value as a byte
|
||||||
* @throws IllegalStateException if the value does not fit within a byte
|
* @throws IllegalStateException if the value does not fit within a byte
|
||||||
*/
|
*/
|
||||||
public static byte castToByte(int value) {
|
public static byte castToByte(int value) {
|
||||||
if(value > Byte.MAX_VALUE || value < Byte.MIN_VALUE) throw new IllegalStateException("Value ["+value+"] out of Byte[-128,127] range");
|
if(value > Byte.MAX_VALUE || value < Byte.MIN_VALUE) throw new IllegalStateException("Value ["+value+"] out of Byte[-128,127] range");
|
||||||
return (byte)value;
|
return (byte)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function to cast a Integer to a Short
|
* Internal function to cast a Integer to a Short
|
||||||
* @param value that should be turned into a short
|
* @param value that should be turned into a short
|
||||||
* @return the value as a short
|
* @return the value as a short
|
||||||
* @throws IllegalStateException if the value does not fit within a short
|
* @throws IllegalStateException if the value does not fit within a short
|
||||||
*/
|
*/
|
||||||
public static short castToShort(int value) {
|
public static short castToShort(int value) {
|
||||||
if(value > Short.MAX_VALUE || value < Short.MIN_VALUE) throw new IllegalStateException("Value ["+value+"] out of Short[-32768,32767] range");
|
if(value > Short.MAX_VALUE || value < Short.MIN_VALUE) throw new IllegalStateException("Value ["+value+"] out of Short[-32768,32767] range");
|
||||||
return (short)value;
|
return (short)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function to cast a Integer to a Character
|
* Internal function to cast a Integer to a Character
|
||||||
* @param value that should be turned into a char
|
* @param value that should be turned into a char
|
||||||
* @return the value as a char
|
* @return the value as a char
|
||||||
* @throws IllegalStateException if the value does not fit within a char
|
* @throws IllegalStateException if the value does not fit within a char
|
||||||
*/
|
*/
|
||||||
public static char castToChar(int value) {
|
public static char castToChar(int value) {
|
||||||
if(value > Character.MAX_VALUE || value < Character.MIN_VALUE) throw new IllegalStateException("Value ["+value+"] out of Character[0,65535] range");
|
if(value > Character.MAX_VALUE || value < Character.MIN_VALUE) throw new IllegalStateException("Value ["+value+"] out of Character[0,65535] range");
|
||||||
return (char)value;
|
return (char)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function to cast a Double to a Double
|
* Internal function to cast a Double to a Double
|
||||||
* @param value that should be turned into a float
|
* @param value that should be turned into a float
|
||||||
* @return the value as a float
|
* @return the value as a float
|
||||||
* @throws IllegalStateException if the value does not fit within a float
|
* @throws IllegalStateException if the value does not fit within a float
|
||||||
*/
|
*/
|
||||||
public static float castToFloat(double value) {
|
public static float castToFloat(double value) {
|
||||||
if(Double.isNaN(value)) return Float.NaN;
|
if(Double.isNaN(value)) return Float.NaN;
|
||||||
if(Double.isInfinite(value)) return value > 0 ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
|
if(Double.isInfinite(value)) return value > 0 ? Float.POSITIVE_INFINITY : Float.NEGATIVE_INFINITY;
|
||||||
if(value < -Float.MAX_VALUE || value > Float.MAX_VALUE) throw new IllegalStateException("Value ["+value+"] out of Float range");
|
if(value < -Float.MAX_VALUE || value > Float.MAX_VALUE) throw new IllegalStateException("Value ["+value+"] out of Float range");
|
||||||
return (float)value;
|
return (float)value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Internal function that checks if the given array-size is big enough for the access.
|
* Internal function that checks if the given array-size is big enough for the access.
|
||||||
* @param arraySize the size of the Array
|
* @param arraySize the size of the Array
|
||||||
* @param offset the offset of the access
|
* @param offset the offset of the access
|
||||||
* @param accessSize the length of the access
|
* @param accessSize the length of the access
|
||||||
* @throws IllegalStateException if offset or accessSize is negative or the range goes out of the array-size
|
* @throws IllegalStateException if offset or accessSize is negative or the range goes out of the array-size
|
||||||
*/
|
*/
|
||||||
public static void checkArrayCapacity(int arraySize, int offset, int accessSize) {
|
public static void checkArrayCapacity(int arraySize, int offset, int accessSize) {
|
||||||
if(offset < 0) throw new IndexOutOfBoundsException("Offset is negative ("+offset+")");
|
if(offset < 0) throw new IndexOutOfBoundsException("Offset is negative ("+offset+")");
|
||||||
else if(accessSize < 0) throw new IllegalArgumentException("Size is negative ("+accessSize+")");
|
else if(accessSize < 0) throw new IllegalArgumentException("Size is negative ("+accessSize+")");
|
||||||
else if(arraySize < offset + accessSize) throw new IndexOutOfBoundsException("Index (" + (offset + accessSize) + ") is not in size (" + arraySize + ")");
|
else if(arraySize < offset + accessSize) throw new IndexOutOfBoundsException("Index (" + (offset + accessSize) + ") is not in size (" + arraySize + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns if the current thread-pool can handle Multi-threading tasks
|
* Returns if the current thread-pool can handle Multi-threading tasks
|
||||||
* @return true if the thread-count is bigger the 1
|
* @return true if the thread-count is bigger the 1
|
||||||
*/
|
*/
|
||||||
public static boolean canParallelTask() {
|
public static boolean canParallelTask() {
|
||||||
return getPool().getParallelism() > 1 || FORCE_IGNORE_PARALLELISM;
|
return getPool().getParallelism() > 1 || FORCE_IGNORE_PARALLELISM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to start a ForkJoinTask. This method will await the finalization of said task
|
* Helper method to start a ForkJoinTask. This method will await the finalization of said task
|
||||||
* @param task the Task to invoke
|
* @param task the Task to invoke
|
||||||
* @param <T> the type of the task
|
* @param <T> the type of the task
|
||||||
*/
|
*/
|
||||||
public static <T> void invokeTask(ForkJoinTask<T> task) {
|
public static <T> void invokeTask(ForkJoinTask<T> task) {
|
||||||
if(FORCE_ASYNC.get().booleanValue()) invokeAsyncTask(task);
|
if(FORCE_ASYNC.get().booleanValue()) invokeAsyncTask(task);
|
||||||
else getPool().invoke(task);
|
else getPool().invoke(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to start a ForkJoinTask. This method will not await the finalization of said task
|
* Helper method to start a ForkJoinTask. This method will not await the finalization of said task
|
||||||
* @param task the Task to invoke
|
* @param task the Task to invoke
|
||||||
* @param <T> the type of the task
|
* @param <T> the type of the task
|
||||||
*/
|
*/
|
||||||
public static <T> void invokeAsyncTask(ForkJoinTask<T> task) {
|
public static <T> void invokeAsyncTask(ForkJoinTask<T> task) {
|
||||||
getPool().execute(task);
|
getPool().execute(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Helper method to start a Async Task. This method will not await the finalization of said task
|
* A Helper method to start a Async Task. This method will not await the finalization of said task
|
||||||
* @param task the Task to invoke
|
* @param task the Task to invoke
|
||||||
*/
|
*/
|
||||||
public static void invokeAsyncTask(Runnable task) {
|
public static void invokeAsyncTask(Runnable task) {
|
||||||
getPool().execute(task);
|
getPool().execute(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to control what ForkJoinPool is being used for any given task.
|
* Helper method to control what ForkJoinPool is being used for any given task.
|
||||||
* @note this method is not thread-save. It is only there to provide control over how Library specific Threaded tasks are handled.
|
* @note this method is not thread-save. It is only there to provide control over how Library specific Threaded tasks are handled.
|
||||||
* @param pool The ForkJoinPool that should receive the tasks. If null {@link ForkJoinPool#commonPool()} is set instead
|
* @param pool The ForkJoinPool that should receive the tasks. If null {@link ForkJoinPool#commonPool()} is set instead
|
||||||
*/
|
*/
|
||||||
public static void setWorkPool(ForkJoinPool pool) {
|
public static void setWorkPool(ForkJoinPool pool) {
|
||||||
WORK_POOL = pool == null ? ForkJoinPool.commonPool() : pool;
|
WORK_POOL = pool == null ? ForkJoinPool.commonPool() : pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ForkJoinPool getPool() {
|
private static ForkJoinPool getPool() {
|
||||||
if(FORCE_TASK_POOL.get().booleanValue()) {
|
if(FORCE_TASK_POOL.get().booleanValue()) {
|
||||||
ForkJoinPool pool = ForkJoinTask.getPool();
|
ForkJoinPool pool = ForkJoinTask.getPool();
|
||||||
if(pool != null) return pool;
|
if(pool != null) return pool;
|
||||||
}
|
}
|
||||||
return WORK_POOL;
|
return WORK_POOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to detect if the Current Thread forces not to await task completion.
|
* Helper method to detect if the Current Thread forces not to await task completion.
|
||||||
* @return if the Current Thread has not to await task completion.
|
* @return if the Current Thread has not to await task completion.
|
||||||
*/
|
*/
|
||||||
public static boolean isForcedAsync() {
|
public static boolean isForcedAsync() {
|
||||||
return FORCE_ASYNC.get().booleanValue();
|
return FORCE_ASYNC.get().booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to detect if the current thread forces to execute tasks in the current Thread-pool if it is a ForkJoinPool.
|
* Helper method to detect if the current thread forces to execute tasks in the current Thread-pool if it is a ForkJoinPool.
|
||||||
* @return if the task checks the current pool to be executed in if it is valid.
|
* @return if the task checks the current pool to be executed in if it is valid.
|
||||||
*/
|
*/
|
||||||
public static boolean isForcedTaskPool() {
|
public static boolean isForcedTaskPool() {
|
||||||
return FORCE_TASK_POOL.get().booleanValue();
|
return FORCE_TASK_POOL.get().booleanValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to decide if the current thread should forcefully not wait on tasks to be completed.
|
* Helper method to decide if the current thread should forcefully not wait on tasks to be completed.
|
||||||
* @param value it tasks should not be awaited for
|
* @param value it tasks should not be awaited for
|
||||||
*/
|
*/
|
||||||
public static void setForcedAsync(boolean value) {
|
public static void setForcedAsync(boolean value) {
|
||||||
FORCE_ASYNC.set(Boolean.valueOf(value));
|
FORCE_ASYNC.set(Boolean.valueOf(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to decide if it should be checked for if the current thread is a ThreadPool Worker (ForkJoinPool Worker to be specific) and if tasks should be delegated into it.
|
* Helper method to decide if it should be checked for if the current thread is a ThreadPool Worker (ForkJoinPool Worker to be specific) and if tasks should be delegated into it.
|
||||||
* @param value if the current thread should check if it is a ThreadPoolWorker.
|
* @param value if the current thread should check if it is a ThreadPoolWorker.
|
||||||
*/
|
*/
|
||||||
public static void setForcedTaskPool(boolean value) {
|
public static void setForcedTaskPool(boolean value) {
|
||||||
FORCE_TASK_POOL.set(Boolean.valueOf(value));
|
FORCE_TASK_POOL.set(Boolean.valueOf(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method to decide if Parallelism should be checked or not.
|
* Helper method to decide if Parallelism should be checked or not.
|
||||||
* @param value if the Parallelism should be ignored
|
* @param value if the Parallelism should be ignored
|
||||||
*/
|
*/
|
||||||
public static void setForceIgnoreParallelism(boolean value) {
|
public static void setForceIgnoreParallelism(boolean value) {
|
||||||
FORCE_IGNORE_PARALLELISM = value;
|
FORCE_IGNORE_PARALLELISM = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Thread Specific Random needed for internal functions in this library.
|
* @return Thread Specific Random needed for internal functions in this library.
|
||||||
*/
|
*/
|
||||||
public static Random getRandom() {
|
public static Random getRandom() {
|
||||||
return RANDOM.get();
|
return RANDOM.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ public abstract class BaseInt2IntMapTest
|
|||||||
if(!getValidMapTests().contains(MapTests.PUT)) return;
|
if(!getValidMapTests().contains(MapTests.PUT)) return;
|
||||||
Int2IntMap putMap = createMap(PUT_ARRAY, PUT_VALUE_ARRAY);
|
Int2IntMap putMap = createMap(PUT_ARRAY, PUT_VALUE_ARRAY);
|
||||||
Assert.assertEquals(PUT_ARRAY.length, putMap.size());
|
Assert.assertEquals(PUT_ARRAY.length, putMap.size());
|
||||||
Assert.assertEquals(0, putMap.put(0, 512));
|
Assert.assertEquals(putMap.getDefaultReturnValue(), putMap.put(0, 512));
|
||||||
Assert.assertEquals(1, putMap.put(513, 2));
|
Assert.assertEquals(1, putMap.put(513, 2));
|
||||||
Assert.assertEquals(PUT_ARRAY.length + 1, putMap.size());
|
Assert.assertEquals(PUT_ARRAY.length + 1, putMap.size());
|
||||||
Assert.assertEquals(512, putMap.addTo(0, 1));
|
Assert.assertEquals(512, putMap.addTo(0, 1));
|
||||||
|
|||||||
Reference in New Issue
Block a user