Finished Function module and added breaking change.

This commit is contained in:
Speiger 2022-12-07 07:31:30 +01:00
parent 342b0cece9
commit 8f7d49b280
39 changed files with 340 additions and 357 deletions

View File

@ -8,6 +8,7 @@
- Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations.
- Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant.
- Removed: BooleanSet and Maps that start with a Boolean classes since they can not be used anyways.
- Breaking Change: Function classes now use the "apply/applyAs/test" format from Java itself, instead of the "get" format. This cleans up a lot of things. But will break existing function class implementations
### Version 0.7.0
- Added: Over 11 Million Unit Tests to this library to ensure quality.

View File

@ -133,6 +133,12 @@ public enum ClassType
}
}
public String getApply(ClassType other) {
if(other == BOOLEAN) return "test";
if(other == ClassType.OBJECT) return "apply";
return "applyAs"+other.getFileType();
}
public String getEquals(boolean not)
{
switch(this)

View File

@ -253,7 +253,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
boolean force = flags.contains("force");
boolean tests = flags.contains("tests");
boolean forceTests = flags.contains("force-tests");
boolean load = !flags.contains("load");
boolean load = flags.contains("load");
boolean save = flags.contains("save");
int flag = (load ? LOAD : 0) | (save ? SAVE : 0);
new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force);

View File

@ -34,8 +34,7 @@ public class FunctionModule extends BaseModule
@Override
protected void loadFunctions()
{
addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get");
addSimpleMapper("TEST_VALUE", keyType.isObject() ? "getBoolean" : "get");
addSimpleMapper("APPLY", keyType.getApply(valueType));
}
@Override

View File

@ -41,7 +41,6 @@ public class JavaModule extends BaseModule
addSimpleMapper("APPLY_KEY_VALUE", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType());
addSimpleMapper("APPLY_VALUE", valueType.isObject() ? "apply" : "applyAs"+valueType.getNonFileType());
addSimpleMapper("APPLY_CAST", "applyAs"+keyType.getCustomJDKType().getNonFileType());
addSimpleMapper("APPLY", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType());
//Shared by Maps and Pairs so moved to java.
addFunctionMappers("ENTRY_KEY", "get%sKey");

View File

@ -183,7 +183,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
* @see Collection#toArray(Object[])
*/
default KEY_TYPE[] TO_ARRAY(Int2ObjectFunction<KEY_TYPE[]> action) {
return TO_ARRAY(action.get(size()));
return TO_ARRAY(action.apply(size()));
}
#else

View File

@ -287,7 +287,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
if(prov != null) {
int size = prov.size();
if(size >= 0) {
KEY_TYPE[] array = action.get(size);
KEY_TYPE[] array = action.apply(size);
ITERATORS.unwrap(array, iterator());
return array;
}
@ -321,7 +321,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
default boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) {
if(filter.TEST_VALUE(iter.NEXT())) return true;
if(filter.test(iter.NEXT())) return true;
}
return false;
}
@ -334,7 +334,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
default boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) {
if(filter.TEST_VALUE(iter.NEXT())) return false;
if(filter.test(iter.NEXT())) return false;
}
return true;
}
@ -347,7 +347,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
default boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) {
if(!filter.TEST_VALUE(iter.NEXT())) return false;
if(!filter.test(iter.NEXT())) return false;
}
return true;
}
@ -361,7 +361,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
Objects.requireNonNull(filter);
for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) {
KEY_TYPE entry = iter.NEXT();
if(filter.TEST_VALUE(entry)) return entry;
if(filter.test(entry)) return entry;
}
return EMPTY_VALUE;
}
@ -432,7 +432,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
Objects.requireNonNull(filter);
int result = 0;
for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) {
if(filter.TEST_VALUE(iter.NEXT())) result++;
if(filter.test(iter.NEXT())) result++;
}
return result;
}

View File

@ -21,12 +21,9 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE
* @param k the value that should be processed
* @return the result of the function
*/
public VALUE_TYPE GET_VALUE(KEY_TYPE k);
public VALUE_TYPE APPLY(KEY_TYPE k);
#if JDK_FUNCTION
#if VALUE_BOOLEAN
@Override
public default VALUE_TYPE test(KEY_TYPE k) { return GET_VALUE(k); }
#if JDK_FUNCTION && VALUE_BOOLEAN
/**
* A Type specific and-function helper function that reduces boxing/unboxing
@ -35,19 +32,19 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE
*/
public default FUNCTION KEY_VALUE_GENERIC_TYPE andType(FUNCTION KEY_VALUE_GENERIC_TYPE other) {
Objects.requireNonNull(other);
return T -> GET_VALUE(T) && other.GET_VALUE(T);
return T -> APPLY(T) && other.APPLY(T);
}
@Override
@Deprecated
public default FUNCTION KEY_VALUE_GENERIC_TYPE and(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) {
Objects.requireNonNull(other);
return T -> GET_VALUE(T) && other.test(T);
return T -> APPLY(T) && other.APPLY(T);
}
@Override
public default FUNCTION KEY_VALUE_GENERIC_TYPE negate() {
return T -> !GET_VALUE(T);
return T -> !APPLY(T);
}
/**
@ -57,23 +54,14 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE
*/
public default FUNCTION KEY_VALUE_GENERIC_TYPE orType(FUNCTION KEY_VALUE_GENERIC_TYPE other) {
Objects.requireNonNull(other);
return T -> GET_VALUE(T) || other.GET_VALUE(T);
return T -> APPLY(T) || other.APPLY(T);
}
@Override
@Deprecated
public default FUNCTION KEY_VALUE_GENERIC_TYPE or(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) {
Objects.requireNonNull(other);
return T -> GET_VALUE(T) || other.test(T);
return T -> APPLY(T) || other.APPLY(T);
}
#else if VALUE_OBJECT
@Override
public default VALUE_TYPE apply(KEY_TYPE k) { return GET_VALUE(k); }
#else
@Override
public default VALUE_TYPE APPLY_VALUE(KEY_TYPE k) { return GET_VALUE(k); }
#endif
#endif
}

View File

@ -649,7 +649,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) return true;
if(filter.test(data[i])) return true;
}
return false;
}
@ -658,7 +658,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) return false;
if(filter.test(data[i])) return false;
}
return true;
}
@ -667,7 +667,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(!filter.TEST_VALUE(data[i])) return false;
if(!filter.test(data[i])) return false;
}
return true;
}
@ -676,7 +676,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) return data[i];
if(filter.test(data[i])) return data[i];
}
return EMPTY_VALUE;
}
@ -725,7 +725,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) result++;
if(filter.test(data[i])) result++;
}
return result;
}

View File

@ -775,7 +775,7 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
Objects.requireNonNull(filter);
KEY_TYPE[] data = this.data;
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) return true;
if(filter.test(data[i])) return true;
}
return false;
}
@ -785,7 +785,7 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
Objects.requireNonNull(filter);
KEY_TYPE[] data = this.data;
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) return false;
if(filter.test(data[i])) return false;
}
return true;
}
@ -795,7 +795,7 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
Objects.requireNonNull(filter);
KEY_TYPE[] data = this.data;
for(int i = 0,m=data.length;i<m;i++) {
if(!filter.TEST_VALUE(data[i])) return false;
if(!filter.test(data[i])) return false;
}
return true;
}
@ -805,7 +805,7 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
Objects.requireNonNull(filter);
KEY_TYPE[] data = this.data;
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) return data[i];
if(filter.test(data[i])) return data[i];
}
return EMPTY_VALUE;
}
@ -858,7 +858,7 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER
KEY_TYPE[] data = this.data;
int result = 0;
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) result++;
if(filter.test(data[i])) result++;
}
return result;
}

View File

@ -303,7 +303,7 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) return true;
if(filter.test(data[i])) return true;
}
return false;
}
@ -312,7 +312,7 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) return false;
if(filter.test(data[i])) return false;
}
return true;
}
@ -321,7 +321,7 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=data.length;i<m;i++) {
if(!filter.TEST_VALUE(data[i])) return false;
if(!filter.test(data[i])) return false;
}
return true;
}
@ -330,7 +330,7 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) return data[i];
if(filter.test(data[i])) return data[i];
}
return EMPTY_VALUE;
}
@ -379,7 +379,7 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0,m=data.length;i<m;i++) {
if(filter.TEST_VALUE(data[i])) result++;
if(filter.test(data[i])) result++;
}
return result;
}

View File

@ -421,7 +421,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) {
if(filter.TEST_VALUE(entry.value)) return true;
if(filter.test(entry.value)) return true;
}
return false;
}
@ -430,7 +430,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) {
if(filter.TEST_VALUE(entry.value)) return false;
if(filter.test(entry.value)) return false;
}
return true;
}
@ -439,7 +439,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) {
if(!filter.TEST_VALUE(entry.value)) return false;
if(!filter.test(entry.value)) return false;
}
return true;
}
@ -448,7 +448,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) {
if(filter.TEST_VALUE(entry.value)) return entry.value;
if(filter.test(entry.value)) return entry.value;
}
return EMPTY_VALUE;
}
@ -497,7 +497,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int result = 0;
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) {
if(filter.TEST_VALUE(entry.value)) result++;
if(filter.test(entry.value)) result++;
}
return result;
}

View File

@ -214,7 +214,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
Objects.requireNonNull(mappingFunction);
VALUE_TYPE value;
if((value = GET_VALUE(key)) == getDefaultReturnValue() || !containsKey(key)) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS_NOT(newValue, getDefaultReturnValue())) {
put(key, newValue);
return newValue;

View File

@ -698,7 +698,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
int index = seg.firstIndex;
while(index != -1) {
entry.set(seg.keys[index], seg.values[index]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
index = (int)seg.links[index];
}
}
@ -720,7 +720,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
int index = seg.firstIndex;
while(index != -1) {
entry.set(seg.keys[index], seg.values[index]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
index = (int)seg.links[index];
}
}
@ -742,7 +742,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
int index = seg.firstIndex;
while(index != -1) {
entry.set(seg.keys[index], seg.values[index]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
index = (int)seg.links[index];
}
}
@ -813,7 +813,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
while(index != -1) {
entry.set(seg.keys[index], seg.values[index]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
index = (int)seg.links[index];
}
}
@ -836,7 +836,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
int index = seg.firstIndex;
while(index != -1) {
entry.set(seg.keys[index], seg.values[index]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
index = (int)seg.links[index];
}
}
@ -1005,7 +1005,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.TEST_VALUE(seg.keys[index])) return true;
if(filter.test(seg.keys[index])) return true;
index = (int)seg.links[index];
}
}
@ -1025,7 +1025,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.TEST_VALUE(seg.keys[index])) return false;
if(filter.test(seg.keys[index])) return false;
index = (int)seg.links[index];
}
}
@ -1045,7 +1045,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(!filter.TEST_VALUE(seg.keys[index])) return false;
if(!filter.test(seg.keys[index])) return false;
index = (int)seg.links[index];
}
}
@ -1138,7 +1138,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.TEST_VALUE(seg.keys[index])) return seg.keys[index];
if(filter.test(seg.keys[index])) return seg.keys[index];
index = (int)seg.links[index];
}
}
@ -1159,7 +1159,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.TEST_VALUE(seg.keys[index])) result++;
if(filter.test(seg.keys[index])) result++;
index = (int)seg.links[index];
}
}
@ -1253,7 +1253,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(seg.values[index])) return true;
if(filter.test(seg.values[index])) return true;
index = (int)seg.links[index];
}
}
@ -1273,7 +1273,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1) {
if(filter.VALUE_TEST_VALUE(seg.values[index])) return false;
if(filter.test(seg.values[index])) return false;
index = (int)seg.links[index];
}
}
@ -1293,7 +1293,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1) {
if(!filter.VALUE_TEST_VALUE(seg.values[index])) return false;
if(!filter.test(seg.values[index])) return false;
index = (int)seg.links[index];
}
}
@ -1387,7 +1387,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(seg.values[index])) return seg.values[index];
if(filter.test(seg.values[index])) return seg.values[index];
index = (int)seg.links[index];
}
}
@ -1408,7 +1408,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = seg.firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(seg.values[index])) result++;
if(filter.test(seg.values[index])) result++;
index = (int)seg.links[index];
}
}
@ -2141,14 +2141,14 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY
try {
int index = findIndex(hash, key);
if(index < 0) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
insert(-index-1, key, newValue);
return newValue;
}
VALUE_TYPE newValue = values[index];
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
newValue = mappingFunction.GET_VALUE(key);
newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
values[index] = newValue;
}

View File

@ -702,7 +702,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
index = (int)links[index];
}
return false;
@ -716,7 +716,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
index = (int)links[index];
}
return true;
@ -730,7 +730,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
index = (int)links[index];
}
return true;
@ -775,7 +775,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
index = (int)links[index];
}
return null;
@ -790,7 +790,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
index = (int)links[index];
}
return result;
@ -961,7 +961,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return false;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return true;
if(filter.test(keys[index])) return true;
index = (int)links[index];
}
return false;
@ -973,7 +973,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return false;
if(filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -985,7 +985,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(!filter.TEST_VALUE(keys[index])) return false;
if(!filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -1043,7 +1043,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return EMPTY_KEY_VALUE;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return keys[index];
if(filter.test(keys[index])) return keys[index];
index = (int)links[index];
}
return EMPTY_KEY_VALUE;
@ -1056,7 +1056,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int result = 0;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) result++;
if(filter.test(keys[index])) result++;
index = (int)links[index];
}
return result;
@ -1124,7 +1124,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return false;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return true;
if(filter.test(values[index])) return true;
index = (int)links[index];
}
return false;
@ -1136,7 +1136,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return false;
if(filter.test(values[index])) return false;
index = (int)links[index];
}
return true;
@ -1148,7 +1148,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(!filter.VALUE_TEST_VALUE(values[index])) return false;
if(!filter.test(values[index])) return false;
index = (int)links[index];
}
return true;
@ -1206,7 +1206,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
if(size() <= 0) return EMPTY_VALUE;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return values[index];
if(filter.test(values[index])) return values[index];
index = (int)links[index];
}
return EMPTY_VALUE;
@ -1219,7 +1219,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M
int result = 0;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) result++;
if(filter.test(values[index])) result++;
index = (int)links[index];
}
return result;

View File

@ -539,14 +539,14 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
Objects.requireNonNull(mappingFunction);
int index = findIndex(key);
if(index < 0) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
insert(-index-1, key, newValue);
return newValue;
}
VALUE_TYPE newValue = values[index];
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
newValue = mappingFunction.GET_VALUE(key);
newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
values[index] = newValue;
}
@ -883,12 +883,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
}
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
}
}
return false;
@ -901,12 +901,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
}
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
}
}
return true;
@ -919,12 +919,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
}
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
entry.set(keys[i], values[i]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
}
}
return true;
@ -970,12 +970,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
}
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
}
}
return null;
@ -989,12 +989,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
int result = 0;
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
}
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
}
}
return result;
@ -1117,9 +1117,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return false;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true;
if(containsNull && filter.test(keys[nullIndex])) return true;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return true;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return true;
}
return false;
}
@ -1128,9 +1128,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return false;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return false;
}
return true;
}
@ -1139,9 +1139,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && !filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.TEST_VALUE(keys[i])) return false;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(keys[i])) return false;
}
return true;
}
@ -1198,9 +1198,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return EMPTY_KEY_VALUE;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex];
if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex];
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return keys[i];
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return keys[i];
}
return EMPTY_KEY_VALUE;
}
@ -1210,9 +1210,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
Objects.requireNonNull(filter);
if(size() <= 0) return 0;
int result = 0;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++;
if(containsNull && filter.test(keys[nullIndex])) result++;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) result++;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) result++;
}
return result;
}
@ -1273,9 +1273,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return false;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return true;
if(containsNull && filter.test(values[nullIndex])) return true;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return true;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return true;
}
return false;
}
@ -1284,9 +1284,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return false;
if(containsNull && filter.test(values[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return false;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return false;
}
return true;
}
@ -1295,9 +1295,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && !filter.VALUE_TEST_VALUE(values[nullIndex])) return false;
if(containsNull && !filter.test(values[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.VALUE_TEST_VALUE(values[i])) return false;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(values[i])) return false;
}
return true;
}
@ -1354,9 +1354,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return EMPTY_VALUE;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return values[nullIndex];
if(containsNull && filter.test(values[nullIndex])) return values[nullIndex];
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return values[i];
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return values[i];
}
return EMPTY_VALUE;
}
@ -1366,9 +1366,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
Objects.requireNonNull(filter);
if(size() <= 0) return 0;
int result = 0;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) result++;
if(containsNull && filter.test(values[nullIndex])) result++;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) result++;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) result++;
}
return result;
}

View File

@ -706,7 +706,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
index = (int)links[index];
}
return false;
@ -720,7 +720,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
index = (int)links[index];
}
return true;
@ -734,7 +734,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
index = (int)links[index];
}
return true;
@ -779,7 +779,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
index = (int)links[index];
}
return null;
@ -794,7 +794,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
index = (int)links[index];
}
return result;
@ -960,7 +960,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return false;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return true;
if(filter.test(keys[index])) return true;
index = (int)links[index];
}
return false;
@ -972,7 +972,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return false;
if(filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -984,7 +984,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1) {
if(!filter.TEST_VALUE(keys[index])) return false;
if(!filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -1042,7 +1042,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return EMPTY_KEY_VALUE;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return keys[index];
if(filter.test(keys[index])) return keys[index];
index = (int)links[index];
}
return EMPTY_KEY_VALUE;
@ -1055,7 +1055,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int result = 0;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) result++;
if(filter.test(keys[index])) result++;
index = (int)links[index];
}
return result;
@ -1124,7 +1124,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return false;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return true;
if(filter.test(values[index])) return true;
index = (int)links[index];
}
return false;
@ -1136,7 +1136,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1) {
if(filter.VALUE_TEST_VALUE(values[index])) return false;
if(filter.test(values[index])) return false;
index = (int)links[index];
}
return true;
@ -1148,7 +1148,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1) {
if(!filter.VALUE_TEST_VALUE(values[index])) return false;
if(!filter.test(values[index])) return false;
index = (int)links[index];
}
return true;
@ -1206,7 +1206,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
if(size() <= 0) return EMPTY_VALUE;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return values[index];
if(filter.test(values[index])) return values[index];
index = (int)links[index];
}
return EMPTY_VALUE;
@ -1219,7 +1219,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G
int result = 0;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) result++;
if(filter.test(values[index])) result++;
index = (int)links[index];
}
return result;

View File

@ -500,14 +500,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
Objects.requireNonNull(mappingFunction);
int index = findIndex(key);
if(index < 0) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
insert(-index-1, key, newValue);
return newValue;
}
VALUE_TYPE newValue = values[index];
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
newValue = mappingFunction.GET_VALUE(key);
newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
values[index] = newValue;
}
@ -843,12 +843,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
}
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i])) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
}
}
return false;
@ -861,12 +861,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
}
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i])) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
}
}
return true;
@ -879,12 +879,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
}
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i])) {
entry.set(keys[i], values[i]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
}
}
return true;
@ -930,12 +930,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
}
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i])) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
}
}
return null;
@ -949,12 +949,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
int result = 0;
if(containsNull) {
entry.set(keys[nullIndex], values[nullIndex]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
}
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i])) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
}
}
return result;
@ -1073,9 +1073,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return false;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true;
if(containsNull && filter.test(keys[nullIndex])) return true;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return true;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return true;
}
return false;
}
@ -1084,9 +1084,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return false;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return false;
}
return true;
}
@ -1095,9 +1095,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && !filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.TEST_VALUE(keys[i])) return false;
if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(keys[i])) return false;
}
return true;
}
@ -1154,9 +1154,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return EMPTY_KEY_VALUE;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex];
if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex];
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return keys[i];
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return keys[i];
}
return EMPTY_KEY_VALUE;
}
@ -1166,9 +1166,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
Objects.requireNonNull(filter);
if(size() <= 0) return 0;
int result = 0;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++;
if(containsNull && filter.test(keys[nullIndex])) result++;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) result++;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) result++;
}
return result;
}
@ -1229,9 +1229,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return false;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return true;
if(containsNull && filter.test(values[nullIndex])) return true;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return true;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return true;
}
return false;
}
@ -1240,9 +1240,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return false;
if(containsNull && filter.test(values[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return false;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return false;
}
return true;
}
@ -1251,9 +1251,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && !filter.VALUE_TEST_VALUE(values[nullIndex])) return false;
if(containsNull && !filter.test(values[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.VALUE_TEST_VALUE(values[i])) return false;
if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(values[i])) return false;
}
return true;
}
@ -1310,9 +1310,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return EMPTY_VALUE;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return values[nullIndex];
if(containsNull && filter.test(values[nullIndex])) return values[nullIndex];
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return values[i];
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return values[i];
}
return EMPTY_VALUE;
}
@ -1322,9 +1322,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
Objects.requireNonNull(filter);
if(size() <= 0) return 0;
int result = 0;
if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) result++;
if(containsNull && filter.test(values[nullIndex])) result++;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) result++;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) result++;
}
return result;
}

View File

@ -677,7 +677,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
index = (int)links[index];
}
return false;
@ -691,7 +691,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
index = (int)links[index];
}
return true;
@ -705,7 +705,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
index = (int)links[index];
}
return true;
@ -750,7 +750,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
index = (int)links[index];
}
return null;
@ -765,7 +765,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int index = firstIndex;
while(index != -1) {
entry.set(keys[index], values[index]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
index = (int)links[index];
}
return result;
@ -903,7 +903,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return false;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return true;
if(filter.test(keys[index])) return true;
index = (int)links[index];
}
return false;
@ -915,7 +915,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return false;
if(filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -927,7 +927,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(!filter.TEST_VALUE(keys[index])) return false;
if(!filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -985,7 +985,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return EMPTY_KEY_VALUE;
int index = firstIndex;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) return keys[index];
if(filter.test(keys[index])) return keys[index];
index = (int)links[index];
}
return EMPTY_KEY_VALUE;
@ -998,7 +998,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int index = firstIndex;
int result = 0;
while(index != -1){
if(filter.TEST_VALUE(keys[index])) result++;
if(filter.test(keys[index])) result++;
index = (int)links[index];
}
return result;
@ -1064,7 +1064,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return false;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return true;
if(filter.test(values[index])) return true;
index = (int)links[index];
}
return false;
@ -1076,7 +1076,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return false;
if(filter.test(values[index])) return false;
index = (int)links[index];
}
return true;
@ -1088,7 +1088,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return true;
int index = firstIndex;
while(index != -1){
if(!filter.VALUE_TEST_VALUE(values[index])) return false;
if(!filter.test(values[index])) return false;
index = (int)links[index];
}
return true;
@ -1146,7 +1146,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
if(size() <= 0) return EMPTY_VALUE;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) return values[index];
if(filter.test(values[index])) return values[index];
index = (int)links[index];
}
return EMPTY_VALUE;
@ -1159,7 +1159,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
int result = 0;
int index = firstIndex;
while(index != -1){
if(filter.VALUE_TEST_VALUE(values[index])) result++;
if(filter.test(values[index])) result++;
index = (int)links[index];
}
return result;

View File

@ -498,14 +498,14 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
Objects.requireNonNull(mappingFunction);
int index = findIndex(key);
if(index == -1) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
insertIndex(size++, key, newValue);
return newValue;
}
VALUE_TYPE newValue = values[index];
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
newValue = mappingFunction.GET_VALUE(key);
newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
values[index] = newValue;
}
@ -802,7 +802,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
for(int i = 0;i<size;i++) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return true;
if(filter.test(entry)) return true;
}
return false;
}
@ -814,7 +814,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
for(int i = 0;i<size;i++) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return false;
if(filter.test(entry)) return false;
}
return true;
}
@ -826,7 +826,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
for(int i = 0;i<size;i++) {
entry.set(keys[i], values[i]);
if(!filter.getBoolean(entry)) return false;
if(!filter.test(entry)) return false;
}
return true;
}
@ -864,7 +864,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
for(int i = 0;i<size;i++) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) return entry;
if(filter.test(entry)) return entry;
}
return null;
}
@ -877,7 +877,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES();
for(int i = 0;i<size;i++) {
entry.set(keys[i], values[i]);
if(filter.getBoolean(entry)) result++;
if(filter.test(entry)) result++;
}
return result;
}
@ -997,7 +997,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
Objects.requireNonNull(filter);
if(size() <= 0) return false;
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(keys[i])) return true;
if(filter.test(keys[i])) return true;
}
return false;
}
@ -1006,7 +1006,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(keys[i])) return false;
if(filter.test(keys[i])) return false;
}
return true;
}
@ -1015,7 +1015,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(!filter.TEST_VALUE(keys[i])) return false;
if(!filter.test(keys[i])) return false;
}
return true;
}
@ -1063,7 +1063,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(keys[i])) return keys[i];
if(filter.test(keys[i])) return keys[i];
}
return EMPTY_KEY_VALUE;
}
@ -1073,7 +1073,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(keys[i])) result++;
if(filter.test(keys[i])) result++;
}
return result;
}
@ -1123,7 +1123,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.VALUE_TEST_VALUE(values[i])) return true;
if(filter.test(values[i])) return true;
}
return false;
}
@ -1132,7 +1132,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.VALUE_TEST_VALUE(values[i])) return false;
if(filter.test(values[i])) return false;
}
return true;
}
@ -1141,7 +1141,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(!filter.VALUE_TEST_VALUE(values[i])) return false;
if(!filter.test(values[i])) return false;
}
return true;
}
@ -1189,7 +1189,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.VALUE_TEST_VALUE(values[i])) return values[i];
if(filter.test(values[i])) return values[i];
}
return EMPTY_VALUE;
}
@ -1199,7 +1199,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0;i<size;i++) {
if(filter.VALUE_TEST_VALUE(values[i])) result++;
if(filter.test(values[i])) result++;
}
return result;
}

View File

@ -376,7 +376,7 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
public VALUE_TYPE COMPUTE_IF_ABSENT(T key, FUNCTION KEY_VALUE_GENERIC_TYPE mappingFunction) {
int index = key.ordinal();
if(!isSet(index)) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
set(index);
values[index] = newValue;
@ -384,7 +384,7 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
}
VALUE_TYPE newValue = values[index];
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
newValue = mappingFunction.GET_VALUE(key);
newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
values[index] = newValue;
}

View File

@ -555,13 +555,13 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
#endif
Node KEY_VALUE_GENERIC_TYPE entry = findNode(key);
if(entry == null) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
put(key, newValue);
return newValue;
}
if(Objects.equals(entry.value, getDefaultReturnValue())) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
entry.value = newValue;
}
@ -1157,7 +1157,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) return true;
if(filter.test(entry.key)) return true;
return false;
}
@ -1165,7 +1165,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) return false;
if(filter.test(entry.key)) return false;
return true;
}
@ -1173,7 +1173,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(!filter.TEST_VALUE(entry.key)) return false;
if(!filter.test(entry.key)) return false;
return true;
}
@ -1218,7 +1218,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) return entry.key;
if(filter.test(entry.key)) return entry.key;
return EMPTY_KEY_VALUE;
}
@ -1227,7 +1227,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
Objects.requireNonNull(filter);
int result = 0;
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) result++;
if(filter.test(entry.key)) result++;
return result;
}
}
@ -1848,7 +1848,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return true;
if(filter.test(subEntry)) return true;
}
return false;
}
@ -1860,7 +1860,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return false;
if(filter.test(subEntry)) return false;
}
return true;
}
@ -1872,7 +1872,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(!filter.getBoolean(subEntry)) return false;
if(!filter.test(subEntry)) return false;
}
return true;
}
@ -1910,7 +1910,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return subEntry;
if(filter.test(subEntry)) return subEntry;
}
return null;
}
@ -1923,7 +1923,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) result++;
if(filter.test(subEntry)) result++;
}
return result;
}
@ -1977,7 +1977,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) return true;
if(filter.test(entry.value)) return true;
return false;
}
@ -1985,7 +1985,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) return false;
if(filter.test(entry.value)) return false;
return true;
}
@ -1993,7 +1993,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(!filter.VALUE_TEST_VALUE(entry.value)) return false;
if(!filter.test(entry.value)) return false;
return true;
}
@ -2038,7 +2038,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) return entry.value;
if(filter.test(entry.value)) return entry.value;
return EMPTY_VALUE;
}
@ -2047,7 +2047,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
Objects.requireNonNull(filter);
int result = 0;
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) result++;
if(filter.test(entry.value)) result++;
return result;
}
}
@ -2325,7 +2325,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) return true;
if(filter.test(entry.value)) return true;
return false;
}
@ -2333,7 +2333,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) return false;
if(filter.test(entry.value)) return false;
return true;
}
@ -2341,7 +2341,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(!filter.VALUE_TEST_VALUE(entry.value)) return false;
if(!filter.test(entry.value)) return false;
return true;
}
@ -2386,7 +2386,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) return entry.value;
if(filter.test(entry.value)) return entry.value;
return EMPTY_VALUE;
}
@ -2395,7 +2395,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
Objects.requireNonNull(filter);
int result = 0;
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) result++;
if(filter.test(entry.value)) result++;
return result;
}
}
@ -2485,7 +2485,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return true;
if(filter.test(subEntry)) return true;
}
return false;
}
@ -2497,7 +2497,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return false;
if(filter.test(subEntry)) return false;
}
return true;
}
@ -2509,7 +2509,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(!filter.getBoolean(subEntry)) return false;
if(!filter.test(subEntry)) return false;
}
return true;
}
@ -2547,7 +2547,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return subEntry;
if(filter.test(subEntry)) return subEntry;
}
return null;
}
@ -2560,7 +2560,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) result++;
if(filter.test(subEntry)) result++;
}
return result;
}

View File

@ -558,13 +558,13 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
#endif
Node KEY_VALUE_GENERIC_TYPE entry = findNode(key);
if(entry == null) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
put(key, newValue);
return newValue;
}
if(Objects.equals(entry.value, getDefaultReturnValue())) {
VALUE_TYPE newValue = mappingFunction.GET_VALUE(key);
VALUE_TYPE newValue = mappingFunction.APPLY(key);
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
entry.value = newValue;
}
@ -1214,7 +1214,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) return true;
if(filter.test(entry.key)) return true;
return false;
}
@ -1222,7 +1222,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) return false;
if(filter.test(entry.key)) return false;
return true;
}
@ -1230,7 +1230,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(!filter.TEST_VALUE(entry.key)) return false;
if(!filter.test(entry.key)) return false;
return true;
}
@ -1275,7 +1275,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) return entry.key;
if(filter.test(entry.key)) return entry.key;
return EMPTY_KEY_VALUE;
}
@ -1284,7 +1284,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
Objects.requireNonNull(filter);
int result = 0;
for(Node KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry))
if(filter.TEST_VALUE(entry.key)) result++;
if(filter.test(entry.key)) result++;
return result;
}
}
@ -1915,7 +1915,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return true;
if(filter.test(subEntry)) return true;
}
return false;
}
@ -1927,7 +1927,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return false;
if(filter.test(subEntry)) return false;
}
return true;
}
@ -1939,7 +1939,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(!filter.getBoolean(subEntry)) return false;
if(!filter.test(subEntry)) return false;
}
return true;
}
@ -1977,7 +1977,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return subEntry;
if(filter.test(subEntry)) return subEntry;
}
return null;
}
@ -1990,7 +1990,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) result++;
if(filter.test(subEntry)) result++;
}
return result;
}
@ -2044,7 +2044,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) return true;
if(filter.test(entry.value)) return true;
return false;
}
@ -2052,7 +2052,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) return false;
if(filter.test(entry.value)) return false;
return true;
}
@ -2060,7 +2060,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(!filter.VALUE_TEST_VALUE(entry.value)) return false;
if(!filter.test(entry.value)) return false;
return true;
}
@ -2105,7 +2105,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) return entry.value;
if(filter.test(entry.value)) return entry.value;
return EMPTY_VALUE;
}
@ -2114,7 +2114,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
Objects.requireNonNull(filter);
int result = 0;
for(Node KEY_VALUE_GENERIC_TYPE entry = subLowest(), last = subHighest();entry != null && (last == null || last != previous(entry));entry = next(entry))
if(filter.VALUE_TEST_VALUE(entry.value)) result++;
if(filter.test(entry.value)) result++;
return result;
}
}
@ -2392,7 +2392,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) return true;
if(filter.test(entry.value)) return true;
return false;
}
@ -2400,7 +2400,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) return false;
if(filter.test(entry.value)) return false;
return true;
}
@ -2408,7 +2408,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(!filter.VALUE_TEST_VALUE(entry.value)) return false;
if(!filter.test(entry.value)) return false;
return true;
}
@ -2453,7 +2453,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) return entry.value;
if(filter.test(entry.value)) return entry.value;
return EMPTY_VALUE;
}
@ -2462,7 +2462,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
Objects.requireNonNull(filter);
int result = 0;
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next())
if(filter.VALUE_TEST_VALUE(entry.value)) result++;
if(filter.test(entry.value)) result++;
return result;
}
}
@ -2552,7 +2552,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return true;
if(filter.test(subEntry)) return true;
}
return false;
}
@ -2564,7 +2564,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return false;
if(filter.test(subEntry)) return false;
}
return true;
}
@ -2576,7 +2576,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(!filter.getBoolean(subEntry)) return false;
if(!filter.test(subEntry)) return false;
}
return true;
}
@ -2614,7 +2614,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) return subEntry;
if(filter.test(subEntry)) return subEntry;
}
return null;
}
@ -2627,7 +2627,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES();
for(Node KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
subEntry.set(entry.key, entry.value);
if(filter.getBoolean(subEntry)) result++;
if(filter.test(subEntry)) result++;
}
return result;
}

View File

@ -435,13 +435,19 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return VALUE_TO_OBJ(replace(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
}
#endif
@Override
public default VALUE_TYPE APPLY(KEY_TYPE key) {
return GET_VALUE(key);
}
/**
* A Type Specific get method to reduce boxing/unboxing
* @param key the key that is searched for
* @return the searched value or default return value
*/
@Override
public VALUE_TYPE GET_VALUE(KEY_TYPE key);
#if !TYPE_OBJECT || !VALUE_OBJECT
/**
* A Type Specific getOrDefault method to reduce boxing/unboxing
* @param key the key that is searched for

View File

@ -270,7 +270,7 @@ public class ARRAY_FIFO_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEUE K
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=size();i<m;i++) {
if(filter.TEST_VALUE(array[(first + i) % array.length])) return true;
if(filter.test(array[(first + i) % array.length])) return true;
}
return false;
}
@ -279,7 +279,7 @@ public class ARRAY_FIFO_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEUE K
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=size();i<m;i++) {
if(filter.TEST_VALUE(array[(first + i) % array.length])) return false;
if(filter.test(array[(first + i) % array.length])) return false;
}
return true;
}
@ -288,7 +288,7 @@ public class ARRAY_FIFO_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEUE K
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0,m=size();i<m;i++) {
if(!filter.TEST_VALUE(array[(first + i) % array.length])) return false;
if(!filter.test(array[(first + i) % array.length])) return false;
}
return true;
}
@ -298,7 +298,7 @@ public class ARRAY_FIFO_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEUE K
Objects.requireNonNull(filter);
for(int i = 0,m=size();i<m;i++) {
int index = (first + i) % array.length;
if(filter.TEST_VALUE(array[index])) {
if(filter.test(array[index])) {
KEY_TYPE data = array[index];
removeIndex(index);
return data;
@ -351,7 +351,7 @@ public class ARRAY_FIFO_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEUE K
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0,m=size();i<m;i++) {
if(filter.TEST_VALUE(array[(first + i) % array.length])) result++;
if(filter.test(array[(first + i) % array.length])) result++;
}
return result;
}

View File

@ -273,7 +273,7 @@ public class ARRAY_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) return true;
if(filter.test(array[i])) return true;
}
return false;
}
@ -282,7 +282,7 @@ public class ARRAY_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) return false;
if(filter.test(array[i])) return false;
}
return true;
}
@ -291,7 +291,7 @@ public class ARRAY_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(!filter.TEST_VALUE(array[i])) return false;
if(!filter.test(array[i])) return false;
}
return true;
}
@ -339,7 +339,7 @@ public class ARRAY_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) {
if(filter.test(array[i])) {
KEY_TYPE data = array[i];
removeIndex(i);
return data;
@ -353,7 +353,7 @@ public class ARRAY_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUE
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) result++;
if(filter.test(array[i])) result++;
}
return result;
}

View File

@ -260,7 +260,7 @@ public class HEAP_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEU
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) return true;
if(filter.test(array[i])) return true;
}
return false;
}
@ -269,7 +269,7 @@ public class HEAP_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEU
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) return false;
if(filter.test(array[i])) return false;
}
return true;
}
@ -278,7 +278,7 @@ public class HEAP_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEU
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(!filter.TEST_VALUE(array[i])) return false;
if(!filter.test(array[i])) return false;
}
return true;
}
@ -326,7 +326,7 @@ public class HEAP_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEU
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) {
if(filter.test(array[i])) {
KEY_TYPE data = array[i];
removeIndex(i);
return data;
@ -340,7 +340,7 @@ public class HEAP_PRIORITY_QUEUE KEY_GENERIC_TYPE extends ABSTRACT_PRIORITY_QUEU
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(array[i])) result++;
if(filter.test(array[i])) result++;
}
return result;
}

View File

@ -190,7 +190,7 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY
* @see Collection#toArray(Object[])
*/
default KEY_TYPE[] TO_ARRAY(Int2ObjectFunction<KEY_TYPE[]> action) {
return TO_ARRAY(action.get(size()));
return TO_ARRAY(action.apply(size()));
}
#endif
}

View File

@ -364,7 +364,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) return true;
if(filter.test(entry.key)) return true;
}
return false;
}
@ -373,7 +373,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) return false;
if(filter.test(entry.key)) return false;
}
return true;
}
@ -382,7 +382,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(!filter.TEST_VALUE(entry.key)) return false;
if(!filter.test(entry.key)) return false;
}
return true;
}
@ -391,7 +391,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) return entry.key;
if(filter.test(entry.key)) return entry.key;
}
return EMPTY_VALUE;
}
@ -440,7 +440,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int result = 0;
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) result++;
if(filter.test(entry.key)) result++;
}
return result;
}
@ -1203,7 +1203,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) return true;
if(filter.test(entry.key)) return true;
}
return false;
}
@ -1212,7 +1212,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) return false;
if(filter.test(entry.key)) return false;
}
return true;
}
@ -1221,7 +1221,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(!filter.TEST_VALUE(entry.key)) return false;
if(!filter.test(entry.key)) return false;
}
return true;
}
@ -1269,7 +1269,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) return entry.key;
if(filter.test(entry.key)) return entry.key;
}
return EMPTY_VALUE;
}
@ -1279,7 +1279,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int result = 0;
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) result++;
if(filter.test(entry.key)) result++;
}
return result;
}

View File

@ -402,7 +402,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) return true;
if(filter.test(data[i])) return true;
}
return false;
}
@ -411,7 +411,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) return false;
if(filter.test(data[i])) return false;
}
return true;
}
@ -420,7 +420,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(!filter.TEST_VALUE(data[i])) return false;
if(!filter.test(data[i])) return false;
}
return true;
}
@ -429,7 +429,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) return data[i];
if(filter.test(data[i])) return data[i];
}
return EMPTY_VALUE;
}
@ -478,7 +478,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im
Objects.requireNonNull(filter);
int result = 0;
for(int i = 0;i<size;i++) {
if(filter.TEST_VALUE(data[i])) result++;
if(filter.test(data[i])) result++;
}
return result;
}

View File

@ -338,7 +338,7 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return true;
if(filter.test(keys[index])) return true;
index = (int)links[index];
}
return false;
@ -349,7 +349,7 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return false;
if(filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -360,7 +360,7 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(!filter.TEST_VALUE(keys[index])) return false;
if(!filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -415,7 +415,7 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return keys[index];
if(filter.test(keys[index])) return keys[index];
index = (int)links[index];
}
return EMPTY_VALUE;
@ -427,7 +427,7 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI
int result = 0;
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) result++;
if(filter.test(keys[index])) result++;
index = (int)links[index];
}
return result;

View File

@ -547,7 +547,7 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return true;
if(filter.test(keys[index])) return true;
index = (int)links[index];
}
return false;
@ -558,7 +558,7 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return false;
if(filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -569,7 +569,7 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(!filter.TEST_VALUE(keys[index])) return false;
if(!filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -624,7 +624,7 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return keys[index];
if(filter.test(keys[index])) return keys[index];
index = (int)links[index];
}
return EMPTY_VALUE;
@ -636,7 +636,7 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY
int result = 0;
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) result++;
if(filter.test(keys[index])) result++;
index = (int)links[index];
}
return result;

View File

@ -402,7 +402,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return true;
if(filter.test(keys[index])) return true;
index = (int)links[index];
}
return false;
@ -413,7 +413,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return false;
if(filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -424,7 +424,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(!filter.TEST_VALUE(keys[index])) return false;
if(!filter.test(keys[index])) return false;
index = (int)links[index];
}
return true;
@ -479,7 +479,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) return keys[index];
if(filter.test(keys[index])) return keys[index];
index = (int)links[index];
}
return EMPTY_VALUE;
@ -491,7 +491,7 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE
int result = 0;
int index = firstIndex;
while(index != -1) {
if(filter.TEST_VALUE(keys[index])) result++;
if(filter.test(keys[index])) result++;
index = (int)links[index];
}
return result;

View File

@ -522,9 +522,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return false;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true;
if(containsNull && filter.test(keys[nullIndex])) return true;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return true;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return true;
}
return false;
}
@ -533,9 +533,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return false;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return false;
}
return true;
}
@ -544,9 +544,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && !filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.TEST_VALUE(keys[i])) return false;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(keys[i])) return false;
}
return true;
}
@ -603,9 +603,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return EMPTY_VALUE;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex];
if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex];
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return keys[i];
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return keys[i];
}
return EMPTY_VALUE;
}
@ -615,9 +615,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T
Objects.requireNonNull(filter);
if(size() <= 0) return 0;
int result = 0;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++;
if(containsNull && filter.test(keys[nullIndex])) result++;
for(int i = nullIndex-1;i>=0;i--) {
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) result++;
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) result++;
}
return result;
}

View File

@ -385,9 +385,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return false;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true;
if(containsNull && filter.test(keys[nullIndex])) return true;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return true;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return true;
}
return false;
}
@ -396,9 +396,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return false;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return false;
}
return true;
}
@ -407,9 +407,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return true;
if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false;
if(containsNull && !filter.test(keys[nullIndex])) return false;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.TEST_VALUE(keys[i])) return false;
if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(keys[i])) return false;
}
return true;
}
@ -466,9 +466,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
if(size() <= 0) return EMPTY_VALUE;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex];
if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex];
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return keys[i];
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return keys[i];
}
return EMPTY_VALUE;
}
@ -478,9 +478,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp
Objects.requireNonNull(filter);
if(size() <= 0) return 0;
int result = 0;
if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++;
if(containsNull && filter.test(keys[nullIndex])) result++;
for(int i = nullIndex-1;i>=0;i--) {
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) result++;
if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) result++;
}
return result;
}

View File

@ -364,7 +364,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) return true;
if(filter.test(entry.key)) return true;
}
return false;
}
@ -373,7 +373,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) return false;
if(filter.test(entry.key)) return false;
}
return true;
}
@ -382,7 +382,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(!filter.TEST_VALUE(entry.key)) return false;
if(!filter.test(entry.key)) return false;
}
return true;
}
@ -430,7 +430,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) return entry.key;
if(filter.test(entry.key)) return entry.key;
}
return EMPTY_VALUE;
}
@ -440,7 +440,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int result = 0;
for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) {
if(filter.TEST_VALUE(entry.key)) result++;
if(filter.test(entry.key)) result++;
}
return result;
}
@ -1264,7 +1264,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) return true;
if(filter.test(entry.key)) return true;
}
return false;
}
@ -1273,7 +1273,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) return false;
if(filter.test(entry.key)) return false;
}
return true;
}
@ -1282,7 +1282,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(!filter.TEST_VALUE(entry.key)) return false;
if(!filter.test(entry.key)) return false;
}
return true;
}
@ -1330,7 +1330,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) {
Objects.requireNonNull(filter);
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) return entry.key;
if(filter.test(entry.key)) return entry.key;
}
return EMPTY_VALUE;
}
@ -1340,7 +1340,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE
Objects.requireNonNull(filter);
int result = 0;
for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) {
if(filter.TEST_VALUE(entry.key)) result++;
if(filter.test(entry.key)) result++;
}
return result;
}

View File

@ -593,11 +593,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
switch(type) {
case 0:
while(shouldRun() && iter.hasNext()) {
#if TYPE_OBJECT
if(filter.getBoolean(iter.NEXT())) {
#else
if(filter.GET_VALUE(iter.NEXT())) {
#endif
if(filter.test(iter.NEXT())) {
setResult(true);
return true;
}
@ -605,11 +601,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
break;
case 1:
while(shouldRun() && iter.hasNext()) {
#if TYPE_OBJECT
if(filter.getBoolean(iter.NEXT())) {
#else
if(filter.GET_VALUE(iter.NEXT())) {
#endif
if(filter.test(iter.NEXT())) {
setResult(false);
return true;
}
@ -617,11 +609,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
break;
case 2:
while(shouldRun() && iter.hasNext()) {
#if TYPE_OBJECT
if(!filter.getBoolean(iter.NEXT())) {
#else
if(!filter.GET_VALUE(iter.NEXT())) {
#endif
if(!filter.test(iter.NEXT())) {
setResult(false);
return true;
}
@ -658,11 +646,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
protected boolean execute() throws Exception {
while(shouldRun() && iter.hasNext()) {
KEY_TYPE entry = iter.NEXT();
#if TYPE_OBJECT
if(filter.getBoolean(iter.NEXT())) {
#else
if(filter.GET_VALUE(iter.NEXT())) {
#endif
if(filter.test(iter.NEXT())) {
setResult(entry);
return true;
}
@ -693,7 +677,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE
@Override
protected boolean execute() throws Exception {
while(shouldRun() && iter.hasNext()) {
if(filter.TEST_VALUE(iter.NEXT())) {
if(filter.test(iter.NEXT())) {
counted++;
}
}

View File

@ -298,7 +298,7 @@ public class ITERABLES
@Override
public void forEach(Consumer<? super T> action) {
Objects.requireNonNull(action);
iterable.forEach(E -> action.accept(mapper.GET_VALUE(E)));
iterable.forEach(E -> action.accept(mapper.apply(E)));
}
}
@ -320,7 +320,7 @@ public class ITERABLES
@Override
public void forEach(Consumer<? super T> action) {
Objects.requireNonNull(action);
iterable.forEach(E -> mapper.GET_VALUE(E).forEach(action));
iterable.forEach(E -> mapper.apply(E).forEach(action));
}
}
@ -344,7 +344,7 @@ public class ITERABLES
public void forEach(Consumer<? super T> action) {
Objects.requireNonNull(action);
iterable.forEach(E -> {
T[] array = mapper.GET_VALUE(E);
T[] array = mapper.apply(E);
for(int i = 0,m=array.length;i<m;action.accept(array[i++]));
});
}
@ -411,12 +411,12 @@ public class ITERABLES
@Override
public void forEach(CONSUMER action) {
Objects.requireNonNull(action);
iterable.forEach(T -> { if(!filter.TEST_VALUE(T)) action.accept(T); } );
iterable.forEach(T -> { if(!filter.test(T)) action.accept(T); } );
}
#else
public void forEach(Consumer<? super CLASS_TYPE> action) {
Objects.requireNonNull(action);
iterable.forEach(T -> { if(!filter.TEST_VALUE(T)) action.accept(T); } );
iterable.forEach(T -> { if(!filter.test(T)) action.accept(T); } );
}
#endif
}

View File

@ -832,7 +832,7 @@ public class ITERATORS
@Override
public T next() {
return mapper.GET_VALUE(iterator.NEXT());
return mapper.apply(iterator.NEXT());
}
@Override
@ -858,7 +858,7 @@ public class ITERATORS
foundNext = true;
while(iterator.hasNext()) {
if(last != null && last.hasNext()) return;
last = mapper.GET_VALUE(iterator.NEXT()).iterator();
last = mapper.apply(iterator.NEXT()).iterator();
}
}
@ -894,7 +894,7 @@ public class ITERATORS
foundNext = true;
while(iterator.hasNext()) {
if(last != null && last.hasNext()) return;
last = ObjectIterators.wrap(mapper.GET_VALUE(iterator.NEXT()));
last = ObjectIterators.wrap(mapper.apply(iterator.NEXT()));
}
}
@ -1045,7 +1045,7 @@ public class ITERATORS
if(foundNext) return;
while(iterator.hasNext()) {
lastFound = iterator.NEXT();
if(filter.TEST_VALUE(lastFound)) {
if(filter.test(lastFound)) {
foundNext = true;
break;
}