Added forEach(CONSUMER, Input)

This commit is contained in:
2026-08-09 21:43:57 +02:00
parent 075f3ad183
commit 2306917b10
29 changed files with 2462 additions and 1842 deletions
@@ -79,6 +79,7 @@ public class FunctionModule extends BaseModule
addBiClassMapper("BI_CONSUMER", "Consumer", "");
addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer");
addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer");
addAbstractMapper("BI_TO_OBJECT_CONSUMER", "%sObjectConsumer");
addAbstractMapper("BI_FROM_INT_CONSUMER", "Int%sConsumer");
if(keyType.isObject()) {
addSimpleMapper("TO_OBJECT_FUNCTION", keyType.getNonFileType()+"UnaryOperator");
@@ -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.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -153,6 +156,18 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
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
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
@@ -9,6 +9,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
#endif
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
/**
* A Type-Specific {@link Iterator} that reduces (un)boxing
@@ -79,6 +82,18 @@ public interface ITERATOR KEY_GENERIC_TYPE extends Iterator<CLASS_TYPE>
while(hasNext()) { action.accept(input, NEXT()); }
}
/**
* 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 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
@@ -50,7 +50,11 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
import speiger.src.collections.PACKAGE.functions.CONSUMER;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -703,6 +707,20 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -49,7 +49,11 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
import speiger.src.collections.PACKAGE.functions.CONSUMER;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -826,6 +830,22 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -49,7 +49,11 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.PACKAGE.utils.ARRAYS;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -359,6 +363,20 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T
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,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);
for(int i = 0,m=data.length;i<m;i++)
action.accept(i, data[i]);
}
@Override
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -47,6 +47,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -512,6 +515,13 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -25,15 +25,20 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR;
#endif
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#if !SAME_TYPE && !TYPE_INT
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
#if !VALUE_BOOLEAN || !JDK_TYPE
@@ -82,6 +87,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
#if !TYPE_OBJECT
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
#if !JDK_VALUE
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -21,9 +21,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#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.function.PREDICATE;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
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
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
#if !JDK_VALUE
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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -22,15 +22,20 @@ import java.util.VALUE_OPTIONAL;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#if !SAME_TYPE && !TYPE_INT
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
#if !VALUE_BOOLEAN || !JDK_TYPE
@@ -77,7 +82,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
#if !SAME_TYPE
#if !TYPE_OBJECT
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
#if !JDK_VALUE
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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -21,9 +21,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#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.function.PREDICATE;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
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 !TYPE_OBJECT
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
#if !JDK_VALUE
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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -22,15 +22,20 @@ import java.util.VALUE_OPTIONAL;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#if !SAME_TYPE && !TYPE_INT
import speiger.src.collections.ints.functions.consumer.VALUE_BI_FROM_INT_CONSUMER;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
#if !VALUE_BOOLEAN || !JDK_TYPE
@@ -76,7 +81,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
#if !TYPE_OBJECT
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
#if !JDK_VALUE
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE;
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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -21,9 +21,14 @@ import java.util.VALUE_OPTIONAL;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#if !SAME_TYPE && !TYPE_INT
@@ -35,7 +40,7 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
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;
#endif
#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.utils.VALUE_ARRAYS;
#endif
#if !VALUE_OBJECT && !VALUE_INT
import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_TO_OBJECT_CONSUMER;
#endif
#endif
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
#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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -21,9 +21,14 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#if !SAME_TYPE && !TYPE_INT
@@ -35,7 +40,7 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
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;
#endif
#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;
#endif
#if !SAME_TYPE
#if VALUE_OBJECT
#if !TYPE_OBJECT
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
#if !JDK_VALUE
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));
}
}
@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
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++]));
}
@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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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++]));
}
@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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -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.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#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
import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
#if !TYPE_OBJECT && !JDK_TYPE
@@ -76,6 +81,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
#if !TYPE_OBJECT
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
#if !JDK_VALUE
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);
}
@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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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));
}
@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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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);
}
@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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE 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));
}
@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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
Objects.requireNonNull(filter);
@@ -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.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
#if !TYPE_INT || !SAME_TYPE
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;
#endif
#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
import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
#endif
#if !TYPE_INT || !SAME_TYPE
#if !TYPE_INT || !SAME_TYPE || !VALUE_OBJECT
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
#endif
#if !TYPE_OBJECT && !JDK_TYPE
@@ -74,7 +79,9 @@ import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer;
#if !SAME_TYPE
#if !TYPE_OBJECT
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
#if !JDK_VALUE
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);
}
@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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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));
}
@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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> 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);
}
@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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE 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);
}
@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
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE 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));
}
@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
public boolean matchesAny(Predicate<MAP.Entry KEY_VALUE_GENERIC_TYPE> filter) {
Objects.requireNonNull(filter);
@@ -33,6 +33,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -425,6 +428,13 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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);
}
@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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -32,6 +32,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -488,6 +491,13 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
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 boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -27,6 +27,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -37,6 +37,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -35,6 +35,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -34,6 +34,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -34,6 +34,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -33,6 +33,9 @@ import speiger.src.collections.PACKAGE.functions.OPTIONAL;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif
@@ -424,6 +427,13 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE 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);
}
@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
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
@@ -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.ints.functions.consumer.BI_FROM_INT_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
import speiger.src.collections.utils.HashUtil;
#endif
@@ -150,6 +153,9 @@ public class COLLECTIONS
/**
* Internal Use mainly. Its a collection wrapper with 0 dependencies for those actions where a collector is needed.
*/
#if !TYPE_OBJECT
@SuppressWarnings("exports")
#endif
public static GENERIC_KEY_BRACES CollectionWrapper KEY_GENERIC_TYPE wrapper() {
return new CollectionWrapperBRACES();
}
@@ -294,6 +300,13 @@ public class COLLECTIONS
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
public <E> void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE<E> action) {
Objects.requireNonNull(action);
@@ -301,6 +314,13 @@ public class COLLECTIONS
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
public boolean trim(int size) {
if(size > size() || size() == elements.length) return false;
@@ -855,6 +875,10 @@ public class COLLECTIONS
@Override
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { synchronized(mutex) { c.forEachIndexed(action); } }
@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(); } }
@Override
public boolean equals(Object obj) {
@@ -864,8 +888,6 @@ public class COLLECTIONS
@Override
public String toString() { synchronized(mutex) { return c.toString(); } }
@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); } }
@Override
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return c.matchesNone(filter); } }
@@ -1010,14 +1032,16 @@ public class COLLECTIONS
@Override
public void forEachIndexed(BI_FROM_INT_CONSUMER KEY_GENERIC_TYPE action) { c.forEachIndexed(action); }
@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(); }
@Override
public boolean equals(Object obj) { return obj == this || c.equals(obj); }
@Override
public String toString() { return c.toString(); }
@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); }
@Override
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { return c.matchesNone(filter); }
@@ -44,6 +44,15 @@ public class FILE_KEY_TYPECollectionForEachTester KEY_GENERIC_TYPE extends ABSTR
HELPERS.assertContentsAnyOrder(elements, createSamplesArray());
}
#ignore
@CollectionFeature.Require(absent = KNOWN_ORDER)
public void testForEachExtraUnknownOrder() {
#endignore
LIST KEY_GENERIC_TYPE elements = new ARRAY_LISTBRACES();
collection.forEach(elements, (K, V) -> V.add(K));
HELPERS.assertContentsAnyOrder(elements, createSamplesArray());
}
#ignore
@CollectionFeature.Require(KNOWN_ORDER)
public void testForEachKnownOrder() {
@@ -70,4 +79,13 @@ public class FILE_KEY_TYPECollectionForEachTester KEY_GENERIC_TYPE extends ABSTR
collection.forEach(elements, LIST::add);
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);
}
}