Map Generation can now be turned off.

This commit is contained in:
Speiger 2022-12-06 03:05:58 +01:00
parent c9fc963670
commit 57280b8285
16 changed files with 1098 additions and 478 deletions

File diff suppressed because it is too large Load Diff

View File

@ -24,13 +24,13 @@ public class SettingsManager
if(!loaded) return true; if(!loaded) return true;
if(!isEnabled(data, base.getModuleName())) return false; if(!isEnabled(data, base.getModuleName())) return false;
JsonObject result = getObject(data, keyType.getClassPath(), false); JsonObject result = getObject(data, keyType.getClassPath(), false);
if(!isEnabled(result, "enabled")) return false; if(!isEnabled(result, "Enabled")) return false;
if(base.isBiModule()) { if(base.isBiModule()) {
result = getObject(result, valueType.getClassPath(), false); result = getObject(result, valueType.getClassPath(), false);
if(!isEnabled(result, "enabled")) return false; if(!isEnabled(result, "Enabled")) return false;
} }
result = getObject(result, base.getModuleName(), false); result = getObject(result, base.getModuleName(), false);
return result.size() <= 0 || isEnabled(result, "enabled"); return result.size() <= 0 || isEnabled(result, "Enabled");
} }
public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType, String entry) public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType, String entry)
@ -38,13 +38,13 @@ public class SettingsManager
if(!loaded) return true; if(!loaded) return true;
if(!isEnabled(data, base.getModuleName())) return false; if(!isEnabled(data, base.getModuleName())) return false;
JsonObject result = getObject(data, keyType.getClassPath(), false); JsonObject result = getObject(data, keyType.getClassPath(), false);
if(!isEnabled(result, "enabled")) return false; if(!isEnabled(result, "Enabled")) return false;
if(base.isBiModule()) { if(base.isBiModule()) {
result = getObject(result, valueType.getClassPath(), false); result = getObject(result, valueType.getClassPath(), false);
if(!isEnabled(result, "enabled")) return false; if(!isEnabled(result, "Enabled")) return false;
} }
result = getObject(result, base.getModuleName(), false); result = getObject(result, base.getModuleName(), false);
return result.size() <= 0 || (isEnabled(result, "enabled") && isEnabled(result, entry)); return result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry));
} }
public void addModule(BaseModule module) { public void addModule(BaseModule module) {
@ -57,7 +57,7 @@ public class SettingsManager
for(ClassType valueType : ModulePackage.TYPE) { for(ClassType valueType : ModulePackage.TYPE) {
if(!module.isModuleValid(keyType, valueType)) continue; if(!module.isModuleValid(keyType, valueType)) continue;
JsonObject obj = new JsonObject(); JsonObject obj = new JsonObject();
obj.addProperty("enabled", true); obj.addProperty("Enabled", true);
for(String key : module.getModuleKeys(keyType, valueType)) { for(String key : module.getModuleKeys(keyType, valueType)) {
obj.addProperty(key, true); obj.addProperty(key, true);
} }
@ -69,7 +69,7 @@ public class SettingsManager
for(ClassType keyType : ModulePackage.TYPE) { for(ClassType keyType : ModulePackage.TYPE) {
if(!module.isModuleValid(keyType, keyType)) continue; if(!module.isModuleValid(keyType, keyType)) continue;
JsonObject obj = new JsonObject(); JsonObject obj = new JsonObject();
obj.addProperty("enabled", true); obj.addProperty("Enabled", true);
for(String key : module.getModuleKeys(keyType, keyType)) { for(String key : module.getModuleKeys(keyType, keyType)) {
obj.addProperty(key, true); obj.addProperty(key, true);
} }

View File

@ -16,19 +16,78 @@ public class MapModule extends BaseModule
@Override @Override
protected void loadVariables() {} protected void loadVariables() {}
@Override @Override
protected void loadFlags() {}
@Override
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
@Override @Override
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) public Set<String> getModuleKeys(ClassType keyType, ClassType valueType)
{ {
return new HashSet<>(Arrays.asList("ConcurrentMap", "HashMap", "CustomHashMap", "ImmutableMap", "ArrayMap", "EnumMap", "AVLTreeMap", "RBTreeMap")); Set<String> sets = new HashSet<>();
sets.add("Maps");
sets.addAll(Arrays.asList("OrderedMap", "SortedMap"));
sets.addAll(Arrays.asList("ArrayMap", "ConcurrentMap", "ImmutableMap"));
sets.addAll(Arrays.asList("HashMap", "LinkedHashMap"));
sets.addAll(Arrays.asList("CustomHashMap", "LinkedCustomHashMap"));
sets.addAll(Arrays.asList("EnumMap", "LinkedEnumMap"));
sets.addAll(Arrays.asList("AVLTreeMap", "RBTreeMap"));
return sets;
}
@Override
protected void loadFlags() {
if(isModuleEnabled()) addFlag("MAP_MODULE");
if(isModuleEnabled("Maps")) addFlag("Maps");
boolean hashMap = isModuleEnabled("HashMap");
boolean customHashMap = isModuleEnabled("CustomHashMap");
boolean enumMap = isModuleEnabled("EnumMap");
if(isModuleEnabled("OrderedMap")) {
addFlag("ORDERED_MAP_FEATURE");
if(isModuleEnabled("ArrayMap")) addFlag("ARRAY_MAP_FEATURE");
if(hashMap && isModuleEnabled("LinkedHashMap")) addFlag("LINKED_MAP_FEATURE");
if(customHashMap && isModuleEnabled("LinkedCustomHashMap")) addFlag("LINKED_CUSTOM_MAP_FEATURE");
if(enumMap && isModuleEnabled("LinkedEnumMap")) addFlag("LINKED_ENUM_MAP_FEATURE");
}
if(isModuleEnabled("SortedMap")) {
addFlag("SORTED_MAP_FEATURE");
if(isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE");
if(isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE");
}
if(isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE");
if(isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE");
if(hashMap) addFlag("HASH_MAP_FEATURE");
if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE");
if(enumMap) addFlag("ENUM_MAP_FEATURE");
} }
@Override @Override
protected void loadBlockades() protected void loadBlockades()
{ {
if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap");
if(!isModuleEnabled("Maps")) addBlockedFiles("Maps");
if(!isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap");
if(!isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap");
boolean ordered = !isModuleEnabled("OrderedMap");
if(ordered) addBlockedFiles("OrderedMap");
boolean hashMap = !isModuleEnabled("HashMap");
if(hashMap) addBlockedFiles("OpenHashMap");
if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap");
boolean customHashMap = !isModuleEnabled("CustomHashMap");
if(customHashMap) addBlockedFiles("OpenCustomHashMap");
if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap");
boolean enumMap = !isModuleEnabled("EnumMap");
if(enumMap) addBlockedFiles("EnumMap");
if(enumMap || ordered || !isModuleEnabled("LinkedEnumMap")) addBlockedFiles("LinkedEnumMap");
if(ordered || isModuleEnabled("ArrayMap")) addBlockedFiles("ArrayMap");
boolean sorted = !isModuleEnabled("SortedMap");
if(sorted) addBlockedFiles("SortedMap", "NavigableMap");
if(sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap");
if(sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap");
if(keyType == ClassType.BOOLEAN) if(keyType == ClassType.BOOLEAN)
{ {
//Main Classes //Main Classes

View File

@ -11,7 +11,9 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
#if MAPS_FEATURE
import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#endif
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
#if !SAME_TYPE #if !SAME_TYPE
@ -19,6 +21,7 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR;
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR; import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR;
#endif #endif
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER; import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER;
import speiger.src.collections.objects.collections.ObjectIterable;
#if !TYPE_OBJECT && !VALUE_OBJECT #if !TYPE_OBJECT && !VALUE_OBJECT
import speiger.src.collections.objects.collections.ObjectIterator; import speiger.src.collections.objects.collections.ObjectIterator;
#endif #endif
@ -47,6 +50,22 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
return this; return this;
} }
protected ObjectIterable<MAP.Entry KEY_VALUE_GENERIC_TYPE> getFastIterable(MAP KEY_VALUE_GENERIC_TYPE map) {
#if MAPS_FEATURE
return MAPS.fastIterable(map);
#else
return map.ENTRY_SET();
#endif
}
protected ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> getFastIterator(MAP KEY_VALUE_GENERIC_TYPE map) {
#if MAPS_FEATURE
return MAPS.fastIterator(map);
#else
return map.ENTRY_SET().iterator();
#endif
}
@Override @Override
public MAP KEY_VALUE_GENERIC_TYPE copy() { public MAP KEY_VALUE_GENERIC_TYPE copy() {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
@ -63,14 +82,14 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
#if VALUE_PRIMITIVES #if VALUE_PRIMITIVES
@Override @Override
public void addToAll(MAP KEY_VALUE_GENERIC_TYPE m) { public void addToAll(MAP KEY_VALUE_GENERIC_TYPE m) {
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m))
addTo(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); addTo(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
} }
#endif #endif
@Override @Override
public void putAll(MAP KEY_VALUE_GENERIC_TYPE m) { public void putAll(MAP KEY_VALUE_GENERIC_TYPE m) {
for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(m);iter.hasNext();) { for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(m);iter.hasNext();) {
MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next();
put(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); put(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
} }
@ -101,7 +120,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
#endif #endif
@Override @Override
public void putAllIfAbsent(MAP KEY_VALUE_GENERIC_TYPE m) { public void putAllIfAbsent(MAP KEY_VALUE_GENERIC_TYPE m) {
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m))
putIfAbsent(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); putIfAbsent(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
} }
@ -161,14 +180,14 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
@Override @Override
public void REPLACE_VALUES(MAP KEY_VALUE_GENERIC_TYPE m) { public void REPLACE_VALUES(MAP KEY_VALUE_GENERIC_TYPE m) {
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m))
replace(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); replace(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
} }
@Override @Override
public void REPLACE_VALUES(UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction) { public void REPLACE_VALUES(UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(this);iter.hasNext();) { for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(this);iter.hasNext();) {
MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next();
entry.setValue(mappingFunction.APPLY_VALUE(entry.ENTRY_KEY(), entry.ENTRY_VALUE())); entry.setValue(mappingFunction.APPLY_VALUE(entry.ENTRY_KEY(), entry.ENTRY_VALUE()));
} }
@ -246,7 +265,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
KEY_TYPE key = entry.ENTRY_KEY(); KEY_TYPE key = entry.ENTRY_KEY();
VALUE_TYPE oldValue = GET_VALUE(key); VALUE_TYPE oldValue = GET_VALUE(key);
VALUE_TYPE newValue = VALUE_EQUALS(oldValue, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(oldValue, entry.ENTRY_VALUE()); VALUE_TYPE newValue = VALUE_EQUALS(oldValue, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(oldValue, entry.ENTRY_VALUE());
@ -298,7 +317,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
@Override @Override
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) { public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) {
Objects.requireNonNull(action); Objects.requireNonNull(action);
for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(this);iter.hasNext();) { for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(this);iter.hasNext();) {
MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next();
action.accept(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); action.accept(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
} }
@ -332,7 +351,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
@Override @Override
public ITERATOR KEY_GENERIC_TYPE iterator() { public ITERATOR KEY_GENERIC_TYPE iterator() {
return new ITERATOR KEY_GENERIC_TYPE() { return new ITERATOR KEY_GENERIC_TYPE() {
ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(ABSTRACT_MAP.this); ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(ABSTRACT_MAP.this);
@Override @Override
public boolean hasNext() { public boolean hasNext() {
return iter.hasNext(); return iter.hasNext();
@ -383,7 +402,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
@Override @Override
public VALUE_ITERATOR VALUE_GENERIC_TYPE iterator() { public VALUE_ITERATOR VALUE_GENERIC_TYPE iterator() {
return new VALUE_ITERATOR VALUE_GENERIC_TYPE() { return new VALUE_ITERATOR VALUE_GENERIC_TYPE() {
ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(ABSTRACT_MAP.this); ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(ABSTRACT_MAP.this);
@Override @Override
public boolean hasNext() { public boolean hasNext() {
return iter.hasNext(); return iter.hasNext();
@ -423,7 +442,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
@Override @Override
public int hashCode() { public int hashCode() {
int hash = 0; int hash = 0;
ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(this); ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(this);
while(iter.hasNext()) hash += iter.next().hashCode(); while(iter.hasNext()) hash += iter.next().hashCode();
return hash; return hash;
} }

View File

@ -24,7 +24,6 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif #endif
import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
@ -607,7 +606,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
KEY_TYPE key = entry.ENTRY_KEY(); KEY_TYPE key = entry.ENTRY_KEY();
int index = findIndex(key); int index = findIndex(key);
VALUE_TYPE newValue = index < 0 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); VALUE_TYPE newValue = index < 0 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE());

View File

@ -24,7 +24,6 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
#endif #endif
import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
@ -568,7 +567,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
KEY_TYPE key = entry.ENTRY_KEY(); KEY_TYPE key = entry.ENTRY_KEY();
int index = findIndex(key); int index = findIndex(key);
VALUE_TYPE newValue = index < 0 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); VALUE_TYPE newValue = index < 0 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE());

View File

@ -28,7 +28,6 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
#endif #endif
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.utils.ARRAYS;
#endif #endif
@ -215,7 +214,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_
KEY_TYPE[] keys = NEW_KEY_ARRAY(map.size()); KEY_TYPE[] keys = NEW_KEY_ARRAY(map.size());
VALUE_TYPE[] values = NEW_VALUE_ARRAY(keys.length); VALUE_TYPE[] values = NEW_VALUE_ARRAY(keys.length);
int index = 0; int index = 0;
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(map)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(map)) {
keys[index] = entry.ENTRY_KEY(); keys[index] = entry.ENTRY_KEY();
values[index] = entry.ENTRY_VALUE(); values[index] = entry.ENTRY_VALUE();
index++; index++;

View File

@ -27,7 +27,6 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR;
@ -176,7 +175,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
*/ */
public ARRAY_MAP(MAP KEY_VALUE_GENERIC_TYPE map) { public ARRAY_MAP(MAP KEY_VALUE_GENERIC_TYPE map) {
this(map.size()); this(map.size());
for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = MAPS.fastIterator(map);iter.hasNext();size++) { for(ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> iter = getFastIterator(map);iter.hasNext();size++) {
MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next();
keys[size] = entry.ENTRY_KEY(); keys[size] = entry.ENTRY_KEY();
values[size] = entry.ENTRY_VALUE(); values[size] = entry.ENTRY_VALUE();
@ -566,7 +565,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
KEY_TYPE key = entry.ENTRY_KEY(); KEY_TYPE key = entry.ENTRY_KEY();
int index = findIndex(key); int index = findIndex(key);
VALUE_TYPE newValue = index == -1 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); VALUE_TYPE newValue = index == -1 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE());

View File

@ -19,7 +19,6 @@ import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
#endif #endif
import speiger.src.collections.PACKAGE.functions.function.FUNCTION; import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
import speiger.src.collections.objects.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.objects.maps.abstracts.ABSTRACT_MAP;
import speiger.src.collections.objects.maps.interfaces.MAP; import speiger.src.collections.objects.maps.interfaces.MAP;
import speiger.src.collections.objects.sets.AbstractObjectSet; import speiger.src.collections.objects.sets.AbstractObjectSet;
@ -449,7 +448,7 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
T key = entry.ENTRY_KEY(); T key = entry.ENTRY_KEY();
int index = key.ordinal(); int index = key.ordinal();
VALUE_TYPE newValue = !isSet(index) || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); VALUE_TYPE newValue = !isSet(index) || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE());

View File

@ -33,7 +33,6 @@ import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
#if TYPE_OBJECT #if TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
#endif #endif
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR;
@ -627,7 +626,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
KEY_TYPE key = entry.ENTRY_KEY(); KEY_TYPE key = entry.ENTRY_KEY();
Node KEY_VALUE_GENERIC_TYPE subEntry = findNode(key); Node KEY_VALUE_GENERIC_TYPE subEntry = findNode(key);
VALUE_TYPE newValue = subEntry == null || VALUE_EQUALS(subEntry.value, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(subEntry.value, entry.ENTRY_VALUE()); VALUE_TYPE newValue = subEntry == null || VALUE_EQUALS(subEntry.value, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(subEntry.value, entry.ENTRY_VALUE());

View File

@ -33,7 +33,6 @@ import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
#if TYPE_OBJECT #if TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
#endif #endif
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR;
@ -630,7 +629,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
@Override @Override
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
Objects.requireNonNull(mappingFunction); Objects.requireNonNull(mappingFunction);
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) {
KEY_TYPE key = entry.ENTRY_KEY(); KEY_TYPE key = entry.ENTRY_KEY();
Node KEY_VALUE_GENERIC_TYPE subEntry = findNode(key); Node KEY_VALUE_GENERIC_TYPE subEntry = findNode(key);
VALUE_TYPE newValue = subEntry == null || VALUE_EQUALS(subEntry.value, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(subEntry.value, entry.ENTRY_VALUE()); VALUE_TYPE newValue = subEntry == null || VALUE_EQUALS(subEntry.value, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(subEntry.value, entry.ENTRY_VALUE());

View File

@ -12,34 +12,65 @@ import java.util.function.Consumer;
import java.util.function.Function; import java.util.function.Function;
#if TYPE_OBJECT #if TYPE_OBJECT
#if AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE
import java.util.Comparator; import java.util.Comparator;
#endif #endif
#endif
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
import speiger.src.collections.PACKAGE.functions.function.FUNCTION; import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
#if !TYPE_OBJECT && !TYPE_BOOLEAN #if !TYPE_OBJECT && !TYPE_BOOLEAN && SORTED_MAP_FEATURE
#if AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE
import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif #endif
#endif
#if !TYPE_BOOLEAN #if !TYPE_BOOLEAN
#if LINKED_CUSTOM_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.customHash.LINKED_CUSTOM_HASH_MAP; import speiger.src.collections.PACKAGE.maps.impl.customHash.LINKED_CUSTOM_HASH_MAP;
#endif
#if CUSTOM_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.customHash.CUSTOM_HASH_MAP; import speiger.src.collections.PACKAGE.maps.impl.customHash.CUSTOM_HASH_MAP;
#endif
#if LINKED_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.hash.LINKED_HASH_MAP; import speiger.src.collections.PACKAGE.maps.impl.hash.LINKED_HASH_MAP;
#endif
#if MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.hash.HASH_MAP; import speiger.src.collections.PACKAGE.maps.impl.hash.HASH_MAP;
#endif
#if IMMUTABLE_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.immutable.IMMUTABLE_HASH_MAP; import speiger.src.collections.PACKAGE.maps.impl.immutable.IMMUTABLE_HASH_MAP;
#endif
#if AVL_TREE_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP; import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP;
#endif
#if RB_TREE_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP; import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP;
#endif
#if ARRAY_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.misc.ARRAY_MAP; import speiger.src.collections.PACKAGE.maps.impl.misc.ARRAY_MAP;
#endif
#if CONCURRENT_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.concurrent.CONCURRENT_HASH_MAP; import speiger.src.collections.PACKAGE.maps.impl.concurrent.CONCURRENT_HASH_MAP;
#endif
#if TYPE_OBJECT #if TYPE_OBJECT
#if ENUM_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.misc.ENUM_MAP; import speiger.src.collections.PACKAGE.maps.impl.misc.ENUM_MAP;
#endif
#if LINKED_ENUM_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.impl.misc.LINKED_ENUM_MAP; import speiger.src.collections.PACKAGE.maps.impl.misc.LINKED_ENUM_MAP;
#endif #endif
#endif
import speiger.src.collections.objects.collections.ObjectIterable; import speiger.src.collections.objects.collections.ObjectIterable;
#if CUSTOM_MAP_FEATURE || LINKED_CUSTOM_MAP_FEATURE
import speiger.src.collections.PACKAGE.utils.STRATEGY; import speiger.src.collections.PACKAGE.utils.STRATEGY;
#endif
#if MAPS_FEATURE
import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#endif #endif
#endif
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
#if !SAME_TYPE #if !SAME_TYPE
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR; import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR;
@ -505,7 +536,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
*/ */
public ObjectSet<Entry KEY_VALUE_GENERIC_TYPE> ENTRY_SET(); public ObjectSet<Entry KEY_VALUE_GENERIC_TYPE> ENTRY_SET();
#if !TYPE_BOOLEAN #if MAPS_FEATURE
/** /**
* Creates a Wrapped Map that is Synchronized * Creates a Wrapped Map that is Synchronized
* @return a new Map that is synchronized * @return a new Map that is synchronized
@ -658,6 +689,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
} }
#endif #endif
#if MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @Type(T) * @Type(T)
@ -731,6 +763,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new HASH_MAPKV_BRACES(map); return new HASH_MAPKV_BRACES(map);
} }
#endif
#if LINKED_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @Type(T) * @Type(T)
@ -804,6 +838,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new IMMUTABLE_HASH_MAPKV_BRACES(map); return new IMMUTABLE_HASH_MAPKV_BRACES(map);
} }
#endif
#if IMMUTABLE_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @param keys the keys that should be inserted * @param keys the keys that should be inserted
@ -856,7 +892,9 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new IMMUTABLE_HASH_MAPKV_BRACES(map); return new IMMUTABLE_HASH_MAPKV_BRACES(map);
} }
#endif
#if TYPE_OBJECT #if TYPE_OBJECT
#if ENUM_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @param keyType the EnumClass that should be used * @param keyType the EnumClass that should be used
@ -924,6 +962,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new ENUM_MAPKV_BRACES(map); return new ENUM_MAPKV_BRACES(map);
} }
#endif
#if LINKED_ENUM_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @param keyType the EnumClass that should be used * @param keyType the EnumClass that should be used
@ -990,7 +1030,10 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
public GENERIC_KEY_ENUM_VALUE_BRACES LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE linkedEnumMap(MAP KEY_VALUE_GENERIC_TYPE map) { public GENERIC_KEY_ENUM_VALUE_BRACES LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE linkedEnumMap(MAP KEY_VALUE_GENERIC_TYPE map) {
return new LINKED_ENUM_MAPKV_BRACES(map); return new LINKED_ENUM_MAPKV_BRACES(map);
} }
#endif #endif
#endif
#if CUSTOM_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @param strategy the Hash Controller * @param strategy the Hash Controller
@ -1070,6 +1113,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new CUSTOM_HASH_MAPKV_BRACES(map, strategy); return new CUSTOM_HASH_MAPKV_BRACES(map, strategy);
} }
#endif
#if LINKED_CUSTOM_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @param strategy the Hash Controller * @param strategy the Hash Controller
@ -1149,6 +1194,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(map, strategy); return new LINKED_CUSTOM_HASH_MAPKV_BRACES(map, strategy);
} }
#endif
#if ARRAY_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @Type(T) * @Type(T)
@ -1222,7 +1269,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new ARRAY_MAPKV_BRACES(map); return new ARRAY_MAPKV_BRACES(map);
} }
#endif
#if RB_TREE_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @Type(T) * @Type(T)
@ -1300,6 +1348,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new RB_TREE_MAPKV_BRACES(map, comp); return new RB_TREE_MAPKV_BRACES(map, comp);
} }
#endif
#if AVL_TREE_MAP_FEATURE
/** /**
* Helper function to unify code * Helper function to unify code
* @Type(T) * @Type(T)
@ -1376,6 +1426,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, COMPARATOR KEY_GENERIC_TYPE comp) { public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, COMPARATOR KEY_GENERIC_TYPE comp) {
return new AVL_TREE_MAPKV_BRACES(map, comp); return new AVL_TREE_MAPKV_BRACES(map, comp);
} }
#endif
} }
/** /**
@ -1454,7 +1505,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
* @return self * @return self
*/ */
public BuilderCache KEY_VALUE_GENERIC_TYPE putAll(MAP KEY_VALUE_GENERIC_TYPE map) { public BuilderCache KEY_VALUE_GENERIC_TYPE putAll(MAP KEY_VALUE_GENERIC_TYPE map) {
#if MAPS_FEATURE
return putAll(MAPS.fastIterable(map)); return putAll(MAPS.fastIterable(map));
#else
return putAll(map.ENTRY_SET());
#endif
} }
/** /**
@ -1483,11 +1538,14 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return this; return this;
} }
#if MAP_FEATURE || LINKED_MAP_FEATURE || CUSTOM_MAP_FEATURE || LINKED_CUSTOM_MAP_FEATURE || AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE || CONCURRENT_MAP_FEATURE
private <E extends MAP KEY_VALUE_GENERIC_TYPE> E putElements(E e){ private <E extends MAP KEY_VALUE_GENERIC_TYPE> E putElements(E e){
e.putAll(keys, values, 0, size); e.putAll(keys, values, 0, size);
return e; return e;
} }
#endif
#if MAP_FEATURE
/** /**
* Builds the Keys and Values into a Hash Map * Builds the Keys and Values into a Hash Map
* @return a HASH_MAP * @return a HASH_MAP
@ -1496,6 +1554,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return putElements(new HASH_MAPKV_BRACES(size)); return putElements(new HASH_MAPKV_BRACES(size));
} }
#endif
#if LINKED_MAP_FEATURE
/** /**
* Builds the Keys and Values into a Linked Hash Map * Builds the Keys and Values into a Linked Hash Map
* @return a LINKED_HASH_MAP * @return a LINKED_HASH_MAP
@ -1504,6 +1564,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return putElements(new LINKED_HASH_MAPKV_BRACES(size)); return putElements(new LINKED_HASH_MAPKV_BRACES(size));
} }
#endif
#if IMMUTABLE_MAP_FEATURE
/** /**
* Builds the Keys and Values into a Immutable Hash Map * Builds the Keys and Values into a Immutable Hash Map
* @return a IMMUTABLE_HASH_MAP * @return a IMMUTABLE_HASH_MAP
@ -1512,6 +1574,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new IMMUTABLE_HASH_MAPKV_BRACES(Arrays.copyOf(keys, size), Arrays.copyOf(values, size)); return new IMMUTABLE_HASH_MAPKV_BRACES(Arrays.copyOf(keys, size), Arrays.copyOf(values, size));
} }
#endif
#if CUSTOM_MAP_FEATURE
/** /**
* Builds the Keys and Values into a Custom Hash Map * Builds the Keys and Values into a Custom Hash Map
* @param strategy the that controls the keys and values * @param strategy the that controls the keys and values
@ -1521,6 +1585,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return putElements(new CUSTOM_HASH_MAPKV_BRACES(size, strategy)); return putElements(new CUSTOM_HASH_MAPKV_BRACES(size, strategy));
} }
#endif
#if LINKED_CUSTOM_MAP_FEATURE
/** /**
* Builds the Keys and Values into a Linked Custom Hash Map * Builds the Keys and Values into a Linked Custom Hash Map
* @param strategy the that controls the keys and values * @param strategy the that controls the keys and values
@ -1530,6 +1596,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return putElements(new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy)); return putElements(new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy));
} }
#endif
#if CONCURRENT_MAP_FEATURE
/** /**
* Builds the Keys and Values into a Concurrent Hash Map * Builds the Keys and Values into a Concurrent Hash Map
* @return a CONCURRENT_HASH_MAP * @return a CONCURRENT_HASH_MAP
@ -1538,6 +1606,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return putElements(new CONCURRENT_HASH_MAPKV_BRACES(size)); return putElements(new CONCURRENT_HASH_MAPKV_BRACES(size));
} }
#endif
#if ARRAY_MAP_FEATURE
/** /**
* Builds the Keys and Values into a Array Map * Builds the Keys and Values into a Array Map
* @return a ARRAY_MAP * @return a ARRAY_MAP
@ -1546,6 +1616,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return new ARRAY_MAPKV_BRACES(keys, values, size); return new ARRAY_MAPKV_BRACES(keys, values, size);
} }
#endif
#if RB_TREE_MAP_FEATURE
/** /**
* Builds the Keys and Values into a RedBlack TreeMap * Builds the Keys and Values into a RedBlack TreeMap
* @return a RB_TREE_MAP * @return a RB_TREE_MAP
@ -1563,6 +1635,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
return putElements(new RB_TREE_MAPKV_BRACES(comp)); return putElements(new RB_TREE_MAPKV_BRACES(comp));
} }
#endif
#if AVL_TREE_MAP_FEATURE
/** /**
* Builds the Keys and Values into a AVL TreeMap * Builds the Keys and Values into a AVL TreeMap
* @return a AVL_TREE_MAP * @return a AVL_TREE_MAP
@ -1579,6 +1653,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
public AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) { public AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
return putElements(new AVL_TREE_MAPKV_BRACES(comp)); return putElements(new AVL_TREE_MAPKV_BRACES(comp));
} }
#endif
} }
#endif #endif
} }

View File

@ -2,7 +2,9 @@ package speiger.src.collections.PACKAGE.maps.interfaces;
import java.util.NavigableMap; import java.util.NavigableMap;
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
#if MAPS_FEATURE
import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#endif
/** /**
* A Type Specific Navigable Map interface with a couple helper methods * A Type Specific Navigable Map interface with a couple helper methods
@ -37,6 +39,8 @@ public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VAL
/** @return a Type Specific Navigable Key Set */ /** @return a Type Specific Navigable Key Set */
@Override @Override
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet(); public NAVIGABLE_SET KEY_GENERIC_TYPE keySet();
#if MAPS_FEATURE
/** /**
* Creates a Wrapped NavigableMap that is Synchronized * Creates a Wrapped NavigableMap that is Synchronized
* @return a new NavigableMap that is synchronized * @return a new NavigableMap that is synchronized
@ -59,6 +63,7 @@ public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VAL
*/ */
public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); } public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
#endif
#if !TYPE_OBJECT #if !TYPE_OBJECT
/** /**
* A Type Specific SubMap method to reduce boxing/unboxing * A Type Specific SubMap method to reduce boxing/unboxing

View File

@ -1,6 +1,8 @@
package speiger.src.collections.PACKAGE.maps.interfaces; package speiger.src.collections.PACKAGE.maps.interfaces;
#if MAPS_FEATURE
import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#endif
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
#endif #endif
@ -102,6 +104,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI
@Override @Override
public ObjectOrderedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> ENTRY_SET(); public ObjectOrderedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> ENTRY_SET();
#if MAPS_FEATURE
/** /**
* Creates a Wrapped SortedMap that is Synchronized * Creates a Wrapped SortedMap that is Synchronized
* @return a new SortedMap that is synchronized * @return a new SortedMap that is synchronized
@ -127,6 +130,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI
@Override @Override
public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); } public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
#endif
/** /**
* Fast Ordered Entry Set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value * Fast Ordered Entry Set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value
* @Type(T) * @Type(T)

View File

@ -10,7 +10,9 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif #endif
import speiger.src.collections.PACKAGE.sets.SORTED_SET; import speiger.src.collections.PACKAGE.sets.SORTED_SET;
#if MAPS_FEATURE
import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#endif
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.objects.sets.ObjectSortedSet; import speiger.src.collections.objects.sets.ObjectSortedSet;
#endif #endif
@ -37,6 +39,7 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
@Override @Override
public VALUE_COLLECTION VALUE_GENERIC_TYPE values(); public VALUE_COLLECTION VALUE_GENERIC_TYPE values();
#if MAPS_FEATURE
/** /**
* Creates a Wrapped SortedMap that is Synchronized * Creates a Wrapped SortedMap that is Synchronized
* @return a new SortedMap that is synchronized * @return a new SortedMap that is synchronized
@ -59,6 +62,7 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
*/ */
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); } public default SORTED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
#endif
#if !TYPE_OBJECT #if !TYPE_OBJECT
/** /**
* A Type Specific SubMap method to reduce boxing/unboxing * A Type Specific SubMap method to reduce boxing/unboxing

View File

@ -3,9 +3,9 @@ package speiger.src.collections.PACKAGE.utils.maps;
#if !TYPE_BOOLEAN #if !TYPE_BOOLEAN
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
#if TYPE_OBJECT #if TYPE_OBJECT && SORTED_MAP_FEATURE
import java.util.Comparator; import java.util.Comparator;
#else #else if !TYPE_OBJECT
import java.util.function.BiConsumer; import java.util.function.BiConsumer;
import java.util.function.BiFunction; import java.util.function.BiFunction;
#endif #endif
@ -18,27 +18,34 @@ import java.util.function.Function;
import speiger.src.collections.objects.collections.ObjectIterable; import speiger.src.collections.objects.collections.ObjectIterable;
import speiger.src.collections.objects.collections.ObjectIterator; import speiger.src.collections.objects.collections.ObjectIterator;
import speiger.src.collections.objects.sets.ObjectSet; import speiger.src.collections.objects.sets.ObjectSet;
#if !TYPE_BOOLEAN
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
import speiger.src.collections.objects.utils.ObjectIterators; import speiger.src.collections.objects.utils.ObjectIterators;
import speiger.src.collections.objects.utils.ObjectSets; import speiger.src.collections.objects.utils.ObjectSets;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.objects.sets.ObjectOrderedSet; import speiger.src.collections.objects.sets.ObjectOrderedSet;
#if SORTED_MAP_FEATURE
import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif #endif
#endif
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
import speiger.src.collections.PACKAGE.functions.function.FUNCTION; import speiger.src.collections.PACKAGE.functions.function.FUNCTION;
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP;
#endif
import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
#if !TYPE_BOOLEAN #if SORTED_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP;
#endif
#if ORDERED_MAP_FEATURE
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
#endif
#if SORTED_MAP_FEATURE
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
import speiger.src.collections.PACKAGE.sets.SORTED_SET; import speiger.src.collections.PACKAGE.sets.SORTED_SET;
#endif
#if ORDERED_MAP_FEATURE
import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.ORDERED_SET;
#endif
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;
import speiger.src.collections.PACKAGE.utils.SETS; import speiger.src.collections.PACKAGE.utils.SETS;
@ -49,7 +56,6 @@ import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPER
#endif #endif
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER; import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER;
import speiger.src.collections.VALUE_PACKAGE.utils.VALUE_COLLECTIONS; import speiger.src.collections.VALUE_PACKAGE.utils.VALUE_COLLECTIONS;
#endif
/** /**
* A Helper class that provides you with Singleton/Empty/Synchronized/Unmodifyable Maps * A Helper class that provides you with Singleton/Empty/Synchronized/Unmodifyable Maps
@ -144,6 +150,7 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE synchronize(MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedMap ? map : new SynchronizedMapKV_BRACES(map, mutex); } public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE synchronize(MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedMap ? map : new SynchronizedMapKV_BRACES(map, mutex); }
#if SORTED_MAP_FEATURE
/** /**
* Helper function that creates a Helper wrapper to synchronize access into the SortedMap. * Helper function that creates a Helper wrapper to synchronize access into the SortedMap.
* @param map the SortedMap that should be synchronized * @param map the SortedMap that should be synchronized
@ -166,6 +173,8 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronize(SORTED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedSortedMap ? map : new SynchronizedSortedMapKV_BRACES(map, mutex); } public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronize(SORTED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedSortedMap ? map : new SynchronizedSortedMapKV_BRACES(map, mutex); }
#endif
#if ORDERED_MAP_FEATURE
/** /**
* Helper function that creates a Helper wrapper to synchronize access into the OrderedMap. * Helper function that creates a Helper wrapper to synchronize access into the OrderedMap.
* @param map the OrderedMap that should be synchronized * @param map the OrderedMap that should be synchronized
@ -188,6 +197,8 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize(ORDERED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedOrderedMap ? map : new SynchronizedOrderedMapKV_BRACES(map, mutex); } public static GENERIC_KEY_VALUE_BRACES ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize(ORDERED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedOrderedMap ? map : new SynchronizedOrderedMapKV_BRACES(map, mutex); }
#endif
#if NAVIGABLE_MAP_FEATURE
/** /**
* Helper function that creates a Helper wrapper to synchronize access into the NavigableMap. * Helper function that creates a Helper wrapper to synchronize access into the NavigableMap.
* @param map the NavigableMap that should be synchronized * @param map the NavigableMap that should be synchronized
@ -210,6 +221,7 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronize(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedNavigableMap ? map : new SynchronizedNavigableMapKV_BRACES(map, mutex); } public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronize(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedNavigableMap ? map : new SynchronizedNavigableMapKV_BRACES(map, mutex); }
#endif
/** /**
* A Helper function that creates a Helper wrapper to only allow Read Access into the Map * A Helper function that creates a Helper wrapper to only allow Read Access into the Map
* @param map the map that should be made Unmodifiable * @param map the map that should be made Unmodifiable
@ -220,6 +232,7 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE unmodifiable(MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableMap ? map : new UnmodifyableMapKV_BRACES(map); } public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE unmodifiable(MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableMap ? map : new UnmodifyableMapKV_BRACES(map); }
#if ORDERED_MAP_FEATURE
/** /**
* A Helper function that creates a Helper wrapper to only allow Read Access into the OrderedMap * A Helper function that creates a Helper wrapper to only allow Read Access into the OrderedMap
* @param map the OrderedMap that should be made Unmodifiable * @param map the OrderedMap that should be made Unmodifiable
@ -230,6 +243,8 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable(ORDERED_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableOrderedMap ? map : new UnmodifyableOrderedMapKV_BRACES(map); } public static GENERIC_KEY_VALUE_BRACES ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable(ORDERED_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableOrderedMap ? map : new UnmodifyableOrderedMapKV_BRACES(map); }
#endif
#if SORTED_MAP_FEATURE
/** /**
* A Helper function that creates a Helper wrapper to only allow Read Access into the SortedMap * A Helper function that creates a Helper wrapper to only allow Read Access into the SortedMap
* @param map the SortedMap that should be made Unmodifiable * @param map the SortedMap that should be made Unmodifiable
@ -250,6 +265,7 @@ public class MAPS
*/ */
public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifiable(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableNavigableMap ? map : new UnmodifyableNavigableMapKV_BRACES(map); } public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifiable(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableNavigableMap ? map : new UnmodifyableNavigableMapKV_BRACES(map); }
#endif
/** /**
* A Helper function that creates a Unmodifyable Entry * A Helper function that creates a Unmodifyable Entry
* @param entry the Entry that should be made unmodifiable * @param entry the Entry that should be made unmodifiable
@ -422,6 +438,7 @@ public class MAPS
public void set(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } public void set(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); }
} }
#if SORTED_MAP_FEATURE
/** /**
* The Unmodifyable Navigable Map implementation that is sued for the unmodifyableMap function * The Unmodifyable Navigable Map implementation that is sued for the unmodifyableMap function
* @Type(T) * @Type(T)
@ -493,6 +510,8 @@ public class MAPS
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); } public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); }
} }
#endif
#if ORDERED_MAP_FEATURE
/** /**
* The Unmodifyable Ordered Map implementation that is sued for the unmodifyableMap function * The Unmodifyable Ordered Map implementation that is sued for the unmodifyableMap function
* @Type(T) * @Type(T)
@ -545,6 +564,8 @@ public class MAPS
} }
} }
#endif
#if SORTED_MAP_FEATURE
/** /**
* The Unmodifyable Sorted Map implementation that is sued for the unmodifyableMap function * The Unmodifyable Sorted Map implementation that is sued for the unmodifyableMap function
* @Type(T) * @Type(T)
@ -584,6 +605,7 @@ public class MAPS
public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); } public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); }
} }
#endif
/** /**
* The Unmodifyable Map implementation that is sued for the unmodifyableMap function * The Unmodifyable Map implementation that is sued for the unmodifyableMap function
* @Type(T) * @Type(T)
@ -666,7 +688,7 @@ public class MAPS
} }
} }
#if ORDERED_MAP_FEATURE
/** /**
* The Unmodifyable Ordered Set implementation for the Unmodifyable Ordered Map implementation * The Unmodifyable Ordered Set implementation for the Unmodifyable Ordered Map implementation
* @Type(T) * @Type(T)
@ -705,6 +727,7 @@ public class MAPS
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLast() { throw new UnsupportedOperationException(); } public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLast() { throw new UnsupportedOperationException(); }
} }
#endif
/** /**
* The Unmodifyable Set implementation for the Unmodifyable Map implementation * The Unmodifyable Set implementation for the Unmodifyable Map implementation
* @Type(T) * @Type(T)
@ -738,6 +761,7 @@ public class MAPS
} }
#if SORTED_MAP_FEATURE
/** /**
* The Synchronized Navigable Map implementation used by the synchronizedMap helper function * The Synchronized Navigable Map implementation used by the synchronizedMap helper function
* @Type(T) * @Type(T)
@ -856,6 +880,8 @@ public class MAPS
#endif #endif
} }
#endif
#if ORDERED_MAP_FEATURE
/** /**
* The Synchronized Ordered Map implementation used by the synchronizedMap helper function * The Synchronized Ordered Map implementation used by the synchronizedMap helper function
* @Type(T) * @Type(T)
@ -913,6 +939,8 @@ public class MAPS
} }
} }
#endif
#if SORTED_MAP_FEATURE
/** /**
* The Synchronized Sorted Map implementation used by the synchronizedMap helper function * The Synchronized Sorted Map implementation used by the synchronizedMap helper function
* @Type(T) * @Type(T)
@ -974,6 +1002,7 @@ public class MAPS
#endif #endif
} }
#endif
/** /**
* The Synchronized Map implementation used by the synchronizedMap helper function * The Synchronized Map implementation used by the synchronizedMap helper function
* @Type(T) * @Type(T)