Loads of new features & fixes.
- Added: pour function directly into Iterable which allows to collect all elements in the Iterable directly. - Added: The new ToArray method from Java9 and newer into the library. Using a functional interface. (Just a backport) - Changed: Reworked how the Map Builder functions are created. They are now in a SubClass that moves them out of the way. Less Clutter. (This might break things if that was used before) - Added: Map Builder that allows now to Build Maps like Guava ImmutableMaps can be build. Note: This has a slight performance overhead. - Added: Unmodifiable and Synchronize wrapper functions direclty into Collection Interfaces. This is mostly a quality of life thing. - Added: Unmodifiable and Synchronized Wrapper Collections can now be cloned. They clone the underlying map which doesn't break functionality. (Had a usecase for it) - Added: A boxed putAll array variant. - Fixed: EnumMaps didn't keep track of their size and now got proper care and implementations as needed. There might be more work required but at least the core functionality is now up to date.
This commit is contained in:
parent
a2506b927a
commit
c4964806f0
10
Changelog.md
10
Changelog.md
|
@ -1,7 +1,15 @@
|
||||||
# Changelog of versions
|
# Changelog of versions
|
||||||
|
|
||||||
### Version 0.4.6
|
### Version 0.5.0
|
||||||
- Added: 2 Helper functions to find out how many bits are required to store a Number.
|
- Added: 2 Helper functions to find out how many bits are required to store a Number.
|
||||||
|
- Added: pour function directly into Iterable which allows to collect all elements in the Iterable directly.
|
||||||
|
- Added: The new ToArray method from Java9 and newer into the library. Using a functional interface. (Just a backport)
|
||||||
|
- Changed: Reworked how the Map Builder functions are created. They are now in a SubClass that moves them out of the way. Less Clutter. (This might break things if that was used before)
|
||||||
|
- Added: Map Builder that allows now to Build Maps like Guava ImmutableMaps can be build. Note: This has a slight performance overhead.
|
||||||
|
- Added: Unmodifiable and Synchronize wrapper functions direclty into Collection Interfaces. This is mostly a quality of life thing.
|
||||||
|
- Added: Unmodifiable and Synchronized Wrapper Collections can now be cloned. They clone the underlying map which doesn't break functionality. (Had a usecase for it)
|
||||||
|
- Added: A boxed putAll array variant.
|
||||||
|
- Fixed: EnumMaps didn't keep track of their size and now got proper care and implementations as needed. There might be more work required but at least the core functionality is now up to date.
|
||||||
|
|
||||||
### Version 0.4.5
|
### Version 0.4.5
|
||||||
- Added: removeAll/retainAll(Collection c, Consumer r) which receives all the elements that got deleted from the collection
|
- Added: removeAll/retainAll(Collection c, Consumer r) which receives all the elements that got deleted from the collection
|
||||||
|
|
|
@ -30,11 +30,13 @@ To highlight things that may be wanted.
|
||||||
- count: counts all valid elements in a collection.
|
- count: counts all valid elements in a collection.
|
||||||
- forEach: Allows to input a second element into a forEach move allowing for more flexibility for Method References
|
- forEach: Allows to input a second element into a forEach move allowing for more flexibility for Method References
|
||||||
- reduce/limit/peek/distinct: Light Versions of the Stream variant, to reduce Stream usage.
|
- reduce/limit/peek/distinct: Light Versions of the Stream variant, to reduce Stream usage.
|
||||||
|
- pour: a function that allows to collect all elements within the Collection
|
||||||
- Collection:
|
- Collection:
|
||||||
- containsAny: Allows to test if another collection contains an of the elements of the tested collection.
|
- containsAny: Allows to test if another collection contains an of the elements of the tested collection.
|
||||||
- primitiveStream: Provides access to the closest Java Stream Type.
|
- primitiveStream: Provides access to the closest Java Stream Type.
|
||||||
- copy: shallowCopies the collection, used instead of clone because this is better to use.
|
- copy: shallowCopies the collection, used instead of clone because this is better to use.
|
||||||
(subCollections/synchronized/unmodifiable not supported for obvious reasons)
|
(subCollections/synchronized/unmodifiable not supported for obvious reasons)
|
||||||
|
- toArray: the ToArray function from Java9 and newer that uses a Functional interface and can use a method reference
|
||||||
- List:
|
- List:
|
||||||
- add/get/removeElements (From FastUtil): Allows to add/get/remove an Array into/from a list. Just with less overhead
|
- add/get/removeElements (From FastUtil): Allows to add/get/remove an Array into/from a list. Just with less overhead
|
||||||
- extractElements: Allows to remove a Range of elements from the List and get what was removed.
|
- extractElements: Allows to remove a Range of elements from the List and get what was removed.
|
||||||
|
|
|
@ -75,6 +75,7 @@ public class GlobalVariables
|
||||||
addSimpleMapper(" GENERIC_VALUE_BRACES", valueType.isObject() ? " <"+valueType.getValueType()+">" : "");
|
addSimpleMapper(" GENERIC_VALUE_BRACES", valueType.isObject() ? " <"+valueType.getValueType()+">" : "");
|
||||||
addInjectMapper(" GENERIC_SPECIAL_KEY_BRACES", type.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>");
|
addInjectMapper(" GENERIC_SPECIAL_KEY_BRACES", type.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>");
|
||||||
addInjectMapper(" GENERIC_SPECIAL_VALUE_BRACES", valueType.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>");
|
addInjectMapper(" GENERIC_SPECIAL_VALUE_BRACES", valueType.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>");
|
||||||
|
addSimpleMapper(" GENERIC_KEY_ENUM_VALUE_BRACES", type.isObject() ? (valueType.isObject() ? " <"+type.getKeyType()+" extends Enum<"+type.getKeyType()+">, "+valueType.getValueType()+">" : " <"+type.getKeyType()+" extends Enum<"+type.getKeyType()+">>") : (valueType.isObject() ? " <"+valueType.getValueType()+">" : ""));
|
||||||
|
|
||||||
addInjectMapper(" GENERIC_KEY_SPECIAL_BRACES", type.isObject() ? " <"+type.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>");
|
addInjectMapper(" GENERIC_KEY_SPECIAL_BRACES", type.isObject() ? " <"+type.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>");
|
||||||
addInjectMapper(" GENERIC_VALUE_SPECIAL_BRACES", valueType.isObject() ? " <"+valueType.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>");
|
addInjectMapper(" GENERIC_VALUE_SPECIAL_BRACES", valueType.isObject() ? " <"+valueType.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>");
|
||||||
|
|
|
@ -10,10 +10,12 @@ import java.util.stream.StreamSupport;
|
||||||
#endif
|
#endif
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
|
||||||
#else
|
#else
|
||||||
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
import speiger.src.collections.PACKAGE.functions.CONSUMER;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.COLLECTIONS;
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,6 +150,17 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
|
||||||
*/
|
*/
|
||||||
public boolean retainAll(COLLECTION KEY_GENERIC_TYPE c, CONSUMER KEY_GENERIC_TYPE r);
|
public boolean retainAll(COLLECTION KEY_GENERIC_TYPE c, CONSUMER KEY_GENERIC_TYPE r);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper function to reduce the usage of Streams and allows to collect all elements
|
||||||
|
* @param collection that the elements should be inserted to
|
||||||
|
* @param <E> the collection type
|
||||||
|
* @return the input with the desired elements
|
||||||
|
*/
|
||||||
|
default <E extends COLLECTION KEY_GENERIC_TYPE> E pour(E collection) {
|
||||||
|
collection.addAll(this);
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Function that does a shallow clone of the Collection itself.
|
* A Function that does a shallow clone of the Collection itself.
|
||||||
* This function is more optimized then a copy constructor since the Collection does not have to be unsorted/resorted.
|
* This function is more optimized then a copy constructor since the Collection does not have to be unsorted/resorted.
|
||||||
|
@ -157,7 +170,18 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
|
||||||
*/
|
*/
|
||||||
public COLLECTION KEY_GENERIC_TYPE copy();
|
public COLLECTION KEY_GENERIC_TYPE copy();
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* A Helper function that simplifies the process of creating a new Array.
|
||||||
|
* @param action the array creation function
|
||||||
|
* @return an array containing all of the elements in this collection
|
||||||
|
* @see Collection#toArray(Object[])
|
||||||
|
*/
|
||||||
|
default KEY_TYPE[] TO_ARRAY(Int2ObjectFunction<KEY_TYPE[]> action) {
|
||||||
|
return TO_ARRAY(action.get(size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
/**
|
/**
|
||||||
* A Type-Specific toArray function that delegates to {@link #TO_ARRAY(KEY_TYPE[])} with a newly created array.
|
* A Type-Specific toArray function that delegates to {@link #TO_ARRAY(KEY_TYPE[])} with a newly created array.
|
||||||
* @return an array containing all of the elements in this collection
|
* @return an array containing all of the elements in this collection
|
||||||
|
@ -244,6 +268,28 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITE
|
||||||
@Override
|
@Override
|
||||||
public ITERATOR KEY_GENERIC_TYPE iterator();
|
public ITERATOR KEY_GENERIC_TYPE iterator();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Collection that is Synchronized
|
||||||
|
* @return a new Collection that is synchronized
|
||||||
|
* @see COLLECTIONS#synchronize
|
||||||
|
*/
|
||||||
|
public default COLLECTION KEY_GENERIC_TYPE synchronize() { return COLLECTIONS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Collection that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new Collection Wrapper that is synchronized
|
||||||
|
* @see COLLECTIONS#synchronize
|
||||||
|
*/
|
||||||
|
public default COLLECTION KEY_GENERIC_TYPE synchronize(Object mutex) { return COLLECTIONS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Collection that is unmodifiable
|
||||||
|
* @return a new Collection Wrapper that is unmodifiable
|
||||||
|
* @see COLLECTIONS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default COLLECTION KEY_GENERIC_TYPE unmodifiable() { return COLLECTIONS.unmodifiable(this); }
|
||||||
|
|
||||||
#if PRIMITIVES
|
#if PRIMITIVES
|
||||||
/**
|
/**
|
||||||
* Returns a Java-Type-Specific Stream to reduce boxing/unboxing.
|
* Returns a Java-Type-Specific Stream to reduce boxing/unboxing.
|
||||||
|
|
|
@ -17,6 +17,7 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
||||||
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
||||||
import speiger.src.collections.PACKAGE.utils.ITERABLES;
|
import speiger.src.collections.PACKAGE.utils.ITERABLES;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type-Specific {@link Iterable} that reduces (un)boxing
|
* A Type-Specific {@link Iterable} that reduces (un)boxing
|
||||||
|
@ -148,6 +149,17 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
|
||||||
return ITERABLES.peek(this, action);
|
return ITERABLES.peek(this, action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper function to reduce the usage of Streams and allows to collect all elements
|
||||||
|
* @param collection that the elements should be inserted to
|
||||||
|
* @param <E> the collection type
|
||||||
|
* @return the input with the desired elements
|
||||||
|
*/
|
||||||
|
default <E extends COLLECTION KEY_GENERIC_TYPE> E pour(E collection) {
|
||||||
|
ITERATORS.pour(iterator(), collection);
|
||||||
|
return collection;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to reduce stream usage that allows to filter for any matches.
|
* Helper function to reduce stream usage that allows to filter for any matches.
|
||||||
* @param filter that should be applied
|
* @param filter that should be applied
|
||||||
|
|
|
@ -1023,8 +1023,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
|
||||||
public <E> E[] toArray(E[] a) {
|
public <E> E[] toArray(E[] a) {
|
||||||
if(a == null) a = (E[])new Object[size];
|
if(a == null) a = (E[])new Object[size];
|
||||||
else if(a.length < size) a = (E[])ObjectArrays.newArray(a.getClass().getComponentType(), size);
|
else if(a.length < size) a = (E[])ObjectArrays.newArray(a.getClass().getComponentType(), size);
|
||||||
for(int i = 0;i<size;i++)
|
System.arraycopy(data, 0, a, 0, size);
|
||||||
a[i] = (E)KEY_TO_OBJ(data[i]);
|
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,8 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
||||||
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.PACKAGE.collections.STACK;
|
import speiger.src.collections.PACKAGE.collections.STACK;
|
||||||
|
#else
|
||||||
|
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.queues.PRIORITY_DEQUEUE;
|
import speiger.src.collections.PACKAGE.queues.PRIORITY_DEQUEUE;
|
||||||
|
@ -961,6 +963,12 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
@Override
|
||||||
|
public T[] toArray(Int2ObjectFunction<T[]> action) {
|
||||||
|
return super.toArray(action);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
@Override
|
||||||
public int size() {
|
public int size() {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.utils.ARRAYS;
|
import speiger.src.collections.PACKAGE.utils.ARRAYS;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.LISTS;
|
||||||
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
||||||
#if TYPE_BYTE || TYPE_SHORT || TYPE_CHAR || TYPE_FLOAT
|
#if TYPE_BYTE || TYPE_SHORT || TYPE_CHAR || TYPE_FLOAT
|
||||||
import speiger.src.collections.utils.SanityChecks;
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
@ -378,6 +379,28 @@ public interface LIST KEY_GENERIC_TYPE extends COLLECTION KEY_GENERIC_TYPE, List
|
||||||
@Override
|
@Override
|
||||||
public LIST KEY_GENERIC_TYPE subList(int from, int to);
|
public LIST KEY_GENERIC_TYPE subList(int from, int to);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped List that is Synchronized
|
||||||
|
* @return a new List that is synchronized
|
||||||
|
* @see LISTS#synchronize
|
||||||
|
*/
|
||||||
|
public default LIST KEY_GENERIC_TYPE synchronize() { return LISTS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped List that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new List Wrapper that is synchronized
|
||||||
|
* @see LISTS#synchronize
|
||||||
|
*/
|
||||||
|
public default LIST KEY_GENERIC_TYPE synchronize(Object mutex) { return LISTS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped List that is unmodifiable
|
||||||
|
* @return a new List Wrapper that is unmodifiable
|
||||||
|
* @see LISTS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default LIST KEY_GENERIC_TYPE unmodifiable() { return LISTS.unmodifiable(this); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A function to ensure the elements are within the requested size.
|
* A function to ensure the elements are within the requested size.
|
||||||
* If smaller then the stored elements they get removed as needed.
|
* If smaller then the stored elements they get removed as needed.
|
||||||
|
|
|
@ -90,6 +90,15 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
|
||||||
for(int i = 0;i<size;i++) put(keys[i], values[i]);
|
for(int i = 0;i<size;i++) put(keys[i], values[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
|
@Override
|
||||||
|
public void putAll(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, int offset, int size) {
|
||||||
|
SanityChecks.checkArrayCapacity(keys.length, offset, size);
|
||||||
|
SanityChecks.checkArrayCapacity(values.length, offset, size);
|
||||||
|
for(int i = 0;i<size;i++) put(keys[i], values[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 : MAPS.fastIterable(m))
|
||||||
|
|
|
@ -138,11 +138,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
public ARRAY_MAP(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, int length) {
|
public ARRAY_MAP(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, int length) {
|
||||||
this(length);
|
this(length);
|
||||||
if(keys.length != values.length) throw new IllegalStateException("Input Arrays are not equal size");
|
if(keys.length != values.length) throw new IllegalStateException("Input Arrays are not equal size");
|
||||||
size = length;
|
putAll(keys, values, 0, length);
|
||||||
for(int i = 0,m=length;i<m;i++) {
|
|
||||||
this.keys[i] = OBJ_TO_KEY(keys[i]);
|
|
||||||
this.values[i] = OBJ_TO_VALUE(values[i]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -165,9 +161,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN
|
||||||
*/
|
*/
|
||||||
public ARRAY_MAP(KEY_TYPE[] keys, VALUE_TYPE[] values, int length) {
|
public ARRAY_MAP(KEY_TYPE[] keys, VALUE_TYPE[] values, int length) {
|
||||||
if(keys.length != values.length) throw new IllegalStateException("Input Arrays are not equal size");
|
if(keys.length != values.length) throw new IllegalStateException("Input Arrays are not equal size");
|
||||||
this.keys = Arrays.copyOf(keys, length);
|
putAll(keys, values, 0, length);
|
||||||
this.values = Arrays.copyOf(values, length);
|
|
||||||
this.size = length;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,9 +3,7 @@ package speiger.src.collections.PACKAGE.maps.impl.misc;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
#if VALUE_OBJECT
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
#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;
|
||||||
|
@ -13,6 +11,14 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR;
|
||||||
#if !VALUE_OBJECT
|
#if !VALUE_OBJECT
|
||||||
import speiger.src.collections.objects.collections.ObjectIterator;
|
import speiger.src.collections.objects.collections.ObjectIterator;
|
||||||
#endif
|
#endif
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER;
|
||||||
|
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR;
|
||||||
|
import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER;
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
|
||||||
|
#endif
|
||||||
|
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;
|
||||||
|
@ -28,13 +34,13 @@ import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE
|
public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
/** Enum Type that is being used */
|
/** Enum Type that is being used */
|
||||||
protected final Class<T> keyType;
|
protected Class<T> keyType;
|
||||||
/** The Backing keys array. */
|
/** The Backing keys array. */
|
||||||
protected transient final T[] keys;
|
protected transient T[] keys;
|
||||||
/** The Backing values array */
|
/** The Backing values array */
|
||||||
protected transient final VALUE_TYPE[] values;
|
protected transient VALUE_TYPE[] values;
|
||||||
/** The Backing array that indicates which index is present or not */
|
/** The Backing array that indicates which index is present or not */
|
||||||
protected transient final long[] present;
|
protected transient long[] present;
|
||||||
/** Amount of Elements stored in the ArrayMap */
|
/** Amount of Elements stored in the ArrayMap */
|
||||||
protected int size = 0;
|
protected int size = 0;
|
||||||
/** EntrySet cache */
|
/** EntrySet cache */
|
||||||
|
@ -44,6 +50,9 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
|
||||||
/** Values cache */
|
/** Values cache */
|
||||||
protected transient VALUE_COLLECTION VALUE_GENERIC_TYPE valuesC;
|
protected transient VALUE_COLLECTION VALUE_GENERIC_TYPE valuesC;
|
||||||
|
|
||||||
|
protected ENUM_MAP() {
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
* @param keyType the type of Enum that should be used
|
* @param keyType the type of Enum that should be used
|
||||||
|
@ -55,6 +64,86 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
|
||||||
present = new long[((keys.length - 1) >> 6) + 1];
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper constructor that allow to create a EnumMap from boxed values (it will unbox them)
|
||||||
|
* @param keys the keys that should be put into the EnumMap
|
||||||
|
* @param values the values that should be put into the EnumMap.
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in lenght
|
||||||
|
*/
|
||||||
|
public ENUM_MAP(T[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
|
if(keys.length <= 0) throw new IllegalArgumentException("Empty Array are not allowed");
|
||||||
|
if(keys.length != values.length) throw new IllegalArgumentException("Keys and Values have to be the same size");
|
||||||
|
keyType = keys[0].getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
putAll(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Helper constructor that allow to create a EnumMap from unboxed values
|
||||||
|
* @param keys the keys that should be put into the map
|
||||||
|
* @param values the values that should be put into the map.
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in lenght
|
||||||
|
*/
|
||||||
|
public ENUM_MAP(T[] keys, VALUE_TYPE[] values) {
|
||||||
|
if(keys.length <= 0) throw new IllegalArgumentException("Empty Array are not allowed");
|
||||||
|
if(keys.length != values.length) throw new IllegalArgumentException("Keys and Values have to be the same size");
|
||||||
|
keyType = keys[0].getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
putAll(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper constructor that allows to create a EnumMap with exactly the same values as the provided map.
|
||||||
|
* @param map the values that should be present in the map
|
||||||
|
*/
|
||||||
|
public ENUM_MAP(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
|
if(map instanceof ENUM_MAP) {
|
||||||
|
ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap = (ENUM_MAP KEY_VALUE_GENERIC_TYPE)map;
|
||||||
|
keyType = enumMap.keyType;
|
||||||
|
keys = enumMap.keys;
|
||||||
|
values = enumMap.values.clone();
|
||||||
|
present = enumMap.present.clone();
|
||||||
|
size = enumMap.size;
|
||||||
|
}
|
||||||
|
else if(map.isEmpty()) throw new IllegalArgumentException("Empty Maps are not allowed");
|
||||||
|
else {
|
||||||
|
keyType = map.keySet().iterator().next().getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
putAll(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific Helper function that allows to create a new EnumMap with exactly the same values as the provided map.
|
||||||
|
* @param map the values that should be present in the map
|
||||||
|
*/
|
||||||
|
public ENUM_MAP(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
|
if(map instanceof ENUM_MAP) {
|
||||||
|
ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap = (ENUM_MAP KEY_VALUE_GENERIC_TYPE)map;
|
||||||
|
keyType = enumMap.keyType;
|
||||||
|
keys = enumMap.keys;
|
||||||
|
values = enumMap.values.clone();
|
||||||
|
present = enumMap.present.clone();
|
||||||
|
size = enumMap.size;
|
||||||
|
}
|
||||||
|
else if(map.isEmpty()) throw new IllegalArgumentException("Empty Maps are not allowed");
|
||||||
|
else {
|
||||||
|
keyType = map.keySet().iterator().next().getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
putAll(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VALUE_TYPE put(T key, VALUE_TYPE value) {
|
public VALUE_TYPE put(T key, VALUE_TYPE value) {
|
||||||
int index = key.ordinal();
|
int index = key.ordinal();
|
||||||
|
@ -203,6 +292,130 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
|
||||||
return valuesC;
|
return valuesC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) {
|
||||||
|
if(size() <= 0) return;
|
||||||
|
for(int i = 0,m=keys.length;i<m;i++) {
|
||||||
|
if(isSet(i)) action.accept(keys[i], values[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean replace(T key, VALUE_TYPE oldValue, VALUE_TYPE newValue) {
|
||||||
|
int index = key.ordinal();
|
||||||
|
if(!isSet(index) || values[index] != oldValue) return false;
|
||||||
|
values[index] = newValue;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VALUE_TYPE replace(T key, VALUE_TYPE value) {
|
||||||
|
int index = key.ordinal();
|
||||||
|
if(!isSet(index)) return getDefaultReturnValue();
|
||||||
|
VALUE_TYPE oldValue = values[index];
|
||||||
|
values[index] = value;
|
||||||
|
return oldValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VALUE_TYPE COMPUTE(T key, UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction) {
|
||||||
|
int index = key.ordinal();
|
||||||
|
if(!isSet(index)) {
|
||||||
|
VALUE_TYPE newValue = mappingFunction.APPLY_VALUE(key, getDefaultReturnValue());
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
|
||||||
|
set(index);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
VALUE_TYPE newValue = mappingFunction.APPLY_VALUE(key, values[index]);
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
|
||||||
|
clear(index);
|
||||||
|
values[index] = EMPTY_VALUE;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
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);
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
|
||||||
|
set(index);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return values[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VALUE_TYPE SUPPLY_IF_ABSENT(T key, VALUE_SUPPLIER VALUE_GENERIC_TYPE valueProvider) {
|
||||||
|
int index = key.ordinal();
|
||||||
|
if(!isSet(index)) {
|
||||||
|
VALUE_TYPE newValue = valueProvider.VALUE_GET_KEY();
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue;
|
||||||
|
set(index);
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
return values[index];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VALUE_TYPE COMPUTE_IF_PRESENT(T key, UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction) {
|
||||||
|
int index = key.ordinal();
|
||||||
|
if(!isSet(index)) return getDefaultReturnValue();
|
||||||
|
VALUE_TYPE newValue = mappingFunction.APPLY_VALUE(key, values[index]);
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
|
||||||
|
clear(index);
|
||||||
|
values[index] = EMPTY_VALUE;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VALUE_TYPE MERGE(T key, VALUE_TYPE value, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
|
||||||
|
int index = key.ordinal();
|
||||||
|
VALUE_TYPE newValue = !isSet(index) ? value : mappingFunction.APPLY_VALUE(values[index], value);
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
|
||||||
|
if(isSet(index)) {
|
||||||
|
clear(index);
|
||||||
|
values[index] = EMPTY_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!isSet(index)) {
|
||||||
|
set(index);
|
||||||
|
values[index] = newValue;
|
||||||
|
}
|
||||||
|
else values[index] = newValue;
|
||||||
|
return newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) {
|
||||||
|
Objects.requireNonNull(mappingFunction);
|
||||||
|
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) {
|
||||||
|
T key = entry.ENTRY_KEY();
|
||||||
|
int index = key.ordinal();
|
||||||
|
VALUE_TYPE newValue = !isSet(index) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE());
|
||||||
|
if(VALUE_EQUALS(newValue, getDefaultReturnValue())) {
|
||||||
|
if(isSet(index)) {
|
||||||
|
clear(index);
|
||||||
|
values[index] = EMPTY_VALUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(!isSet(index)) {
|
||||||
|
set(index);
|
||||||
|
values[index] = newValue;
|
||||||
|
}
|
||||||
|
else values[index] = newValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
if(size == 0) return;
|
if(size == 0) return;
|
||||||
|
@ -220,16 +433,18 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void set(int index) {
|
protected void set(int index) {
|
||||||
|
size++;
|
||||||
present[index >> 6] |= (1L << index);
|
present[index >> 6] |= (1L << index);
|
||||||
onNodeAdded(index);
|
onNodeAdded(index);
|
||||||
}
|
}
|
||||||
protected void clear(int index) {
|
protected void clear(int index) {
|
||||||
|
size--;
|
||||||
present[index >> 6] &= ~(1L << index);
|
present[index >> 6] &= ~(1L << index);
|
||||||
onNodeRemoved(index);
|
onNodeRemoved(index);
|
||||||
}
|
}
|
||||||
protected boolean isSet(int index) { return (present[index >> 6] & (1L << index)) != 0; }
|
protected boolean isSet(int index) { return (present[index >> 6] & (1L << index)) != 0; }
|
||||||
|
|
||||||
private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
|
protected static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
|
||||||
return keyType.getEnumConstants();
|
return keyType.getEnumConstants();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,136 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA
|
||||||
links = new long[keys.length];
|
links = new long[keys.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper constructor that allow to create a EnumMap from boxed values (it will unbox them)
|
||||||
|
* @param keys the keys that should be put into the EnumMap
|
||||||
|
* @param values the values that should be put into the EnumMap.
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in lenght
|
||||||
|
*/
|
||||||
|
public LINKED_ENUM_MAP(T[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
|
if(keys.length <= 0) throw new IllegalArgumentException("Empty Array are not allowed");
|
||||||
|
if(keys.length != values.length) throw new IllegalArgumentException("Keys and Values have to be the same size");
|
||||||
|
keyType = keys[0].getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
links = new long[keys.length];
|
||||||
|
putAll(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Helper constructor that allow to create a EnumMap from unboxed values
|
||||||
|
* @param keys the keys that should be put into the map
|
||||||
|
* @param values the values that should be put into the map.
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in lenght
|
||||||
|
*/
|
||||||
|
public LINKED_ENUM_MAP(T[] keys, VALUE_TYPE[] values) {
|
||||||
|
if(keys.length <= 0) throw new IllegalArgumentException("Empty Array are not allowed");
|
||||||
|
if(keys.length != values.length) throw new IllegalArgumentException("Keys and Values have to be the same size");
|
||||||
|
keyType = keys[0].getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
links = new long[keys.length];
|
||||||
|
putAll(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper constructor that allows to create a EnumMap with exactly the same values as the provided map.
|
||||||
|
* @param map the values that should be present in the map
|
||||||
|
*/
|
||||||
|
public LINKED_ENUM_MAP(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
|
if(map instanceof LINKED_ENUM_MAP) {
|
||||||
|
LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap = (LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE)map;
|
||||||
|
keyType = enumMap.keyType;
|
||||||
|
keys = enumMap.keys;
|
||||||
|
values = enumMap.values.clone();
|
||||||
|
present = enumMap.present.clone();
|
||||||
|
links = enumMap.links.clone();
|
||||||
|
size = enumMap.size;
|
||||||
|
}
|
||||||
|
if(map instanceof ENUM_MAP) {
|
||||||
|
ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap = (ENUM_MAP KEY_VALUE_GENERIC_TYPE)map;
|
||||||
|
keyType = enumMap.keyType;
|
||||||
|
keys = enumMap.keys;
|
||||||
|
values = enumMap.values.clone();
|
||||||
|
present = enumMap.present.clone();
|
||||||
|
links = new long[keys.length];
|
||||||
|
for(int i = 0,m=keys.length;i<m;i++) {
|
||||||
|
if(isSet(i)) {
|
||||||
|
if(size == 0) {
|
||||||
|
firstIndex = lastIndex = i;
|
||||||
|
links[i] = -1L;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
links[lastIndex] ^= ((links[lastIndex] ^ (i & 0xFFFFFFFFL)) & 0xFFFFFFFFL);
|
||||||
|
links[i] = ((lastIndex & 0xFFFFFFFFL) << 32) | 0xFFFFFFFFL;
|
||||||
|
lastIndex = i;
|
||||||
|
}
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(map.isEmpty()) throw new IllegalArgumentException("Empty Maps are not allowed");
|
||||||
|
else {
|
||||||
|
keyType = map.keySet().iterator().next().getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
links = new long[keys.length];
|
||||||
|
putAll(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific Helper function that allows to create a new EnumMap with exactly the same values as the provided map.
|
||||||
|
* @param map the values that should be present in the map
|
||||||
|
*/
|
||||||
|
public LINKED_ENUM_MAP(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
|
if(map instanceof LINKED_ENUM_MAP) {
|
||||||
|
LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap = (LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE)map;
|
||||||
|
keyType = enumMap.keyType;
|
||||||
|
keys = enumMap.keys;
|
||||||
|
values = enumMap.values.clone();
|
||||||
|
present = enumMap.present.clone();
|
||||||
|
links = enumMap.links.clone();
|
||||||
|
size = enumMap.size;
|
||||||
|
}
|
||||||
|
if(map instanceof ENUM_MAP) {
|
||||||
|
ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap = (ENUM_MAP KEY_VALUE_GENERIC_TYPE)map;
|
||||||
|
keyType = enumMap.keyType;
|
||||||
|
keys = enumMap.keys;
|
||||||
|
values = enumMap.values.clone();
|
||||||
|
present = enumMap.present.clone();
|
||||||
|
links = new long[keys.length];
|
||||||
|
for(int i = 0,m=keys.length;i<m;i++) {
|
||||||
|
if(isSet(i)) {
|
||||||
|
if(size == 0) {
|
||||||
|
firstIndex = lastIndex = i;
|
||||||
|
links[i] = -1L;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
links[lastIndex] ^= ((links[lastIndex] ^ (i & 0xFFFFFFFFL)) & 0xFFFFFFFFL);
|
||||||
|
links[i] = ((lastIndex & 0xFFFFFFFFL) << 32) | 0xFFFFFFFFL;
|
||||||
|
lastIndex = i;
|
||||||
|
}
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(map.isEmpty()) throw new IllegalArgumentException("Empty Maps are not allowed");
|
||||||
|
else {
|
||||||
|
keyType = map.keySet().iterator().next().getDeclaringClass();
|
||||||
|
this.keys = getKeyUniverse(keyType);
|
||||||
|
this.values = NEW_VALUE_ARRAY(keys.length);
|
||||||
|
present = new long[((keys.length - 1) >> 6) + 1];
|
||||||
|
links = new long[keys.length];
|
||||||
|
putAll(map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VALUE_TYPE putAndMoveToFirst(T key, VALUE_TYPE value) {
|
public VALUE_TYPE putAndMoveToFirst(T key, VALUE_TYPE value) {
|
||||||
int index = key.ordinal();
|
int index = key.ordinal();
|
||||||
|
|
|
@ -4,10 +4,15 @@ import java.util.Map;
|
||||||
#if VALUE_OBJECT && !TYPE_OBJECT
|
#if VALUE_OBJECT && !TYPE_OBJECT
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
#endif
|
#endif
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Arrays;
|
||||||
|
#endif
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiFunction;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +32,14 @@ import speiger.src.collections.PACKAGE.maps.impl.hash.HASH_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.immutable.IMMUTABLE_HASH_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.immutable.IMMUTABLE_HASH_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP;
|
||||||
import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP;
|
import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP;
|
||||||
|
import speiger.src.collections.PACKAGE.maps.impl.misc.ARRAY_MAP;
|
||||||
|
#if TYPE_OBJECT
|
||||||
|
import speiger.src.collections.PACKAGE.maps.impl.misc.ENUM_MAP;
|
||||||
|
import speiger.src.collections.PACKAGE.maps.impl.misc.LINKED_ENUM_MAP;
|
||||||
|
#endif
|
||||||
|
import speiger.src.collections.objects.collections.ObjectIterable;
|
||||||
import speiger.src.collections.PACKAGE.utils.STRATEGY;
|
import speiger.src.collections.PACKAGE.utils.STRATEGY;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.sets.SET;
|
import speiger.src.collections.PACKAGE.sets.SET;
|
||||||
#if !SAME_TYPE
|
#if !SAME_TYPE
|
||||||
|
@ -38,6 +50,10 @@ import speiger.src.collections.objects.collections.ObjectIterator;
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
#endif
|
#endif
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
import speiger.src.collections.utils.HashUtil;
|
||||||
|
import speiger.src.collections.utils.SanityChecks;
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific Map that reduces memory overhead due to boxing/unboxing of Primitives
|
* A Type Specific Map that reduces memory overhead due to boxing/unboxing of Primitives
|
||||||
|
@ -47,6 +63,16 @@ import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
*/
|
*/
|
||||||
public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_TYPE>, FUNCTION KEY_VALUE_GENERIC_TYPE
|
public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_TYPE>, FUNCTION KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
/**
|
||||||
|
* Helper Class that allows to create Maps without requiring a to type out the entire implementation or know it.
|
||||||
|
* @return a MapBuilder
|
||||||
|
*/
|
||||||
|
public static MapBuilder builder() {
|
||||||
|
return MapBuilder.INSTANCE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Method to see what the default return value is.
|
* Method to see what the default return value is.
|
||||||
* @return default return value
|
* @return default return value
|
||||||
|
@ -100,6 +126,31 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
*/
|
*/
|
||||||
public void putAll(KEY_TYPE[] keys, VALUE_TYPE[] values, int offset, int size);
|
public void putAll(KEY_TYPE[] keys, VALUE_TYPE[] values, int offset, int size);
|
||||||
|
|
||||||
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Type Specific Object array method to bulk add elements into a map without creating a wrapper and increasing performances
|
||||||
|
* @param keys the keys that should be added
|
||||||
|
* @param values the values that should be added
|
||||||
|
* @see Map#putAll(Map)
|
||||||
|
* @throws IllegalStateException if the arrays are not the same size
|
||||||
|
*/
|
||||||
|
public default void putAll(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
|
if(keys.length != values.length) throw new IllegalStateException("Array sizes do not match");
|
||||||
|
putAll(keys, values, 0, keys.length);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type Specific Object array method to bulk add elements into a map without creating a wrapper and increasing performances
|
||||||
|
* @param keys the keys that should be added
|
||||||
|
* @param values the values that should be added
|
||||||
|
* @param offset where the to start in the array
|
||||||
|
* @param size how many elements should be added
|
||||||
|
* @see Map#putAll(Map)
|
||||||
|
* @throws IllegalStateException if the arrays are not within the range
|
||||||
|
*/
|
||||||
|
public void putAll(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, int offset, int size);
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Type Specific method to reduce boxing/unboxing of values
|
* Type Specific method to reduce boxing/unboxing of values
|
||||||
* @param key the key that should be inserted,
|
* @param key the key that should be inserted,
|
||||||
|
@ -415,6 +466,30 @@ 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
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Map that is Synchronized
|
||||||
|
* @return a new Map that is synchronized
|
||||||
|
* @see MAPS#synchronize
|
||||||
|
*/
|
||||||
|
public default MAP KEY_VALUE_GENERIC_TYPE synchronize() { return MAPS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Map that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new Map Wrapper that is synchronized
|
||||||
|
* @see MAPS#synchronize
|
||||||
|
*/
|
||||||
|
public default MAP KEY_VALUE_GENERIC_TYPE synchronize(Object mutex) { return MAPS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Map that is unmodifiable
|
||||||
|
* @return a new Map Wrapper that is unmodifiable
|
||||||
|
* @see MAPS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
|
||||||
|
|
||||||
|
#endif
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
@Primitive
|
@Primitive
|
||||||
|
@ -478,19 +553,79 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws UnsupportedOperationException if the Entry is immutable or not supported
|
* @throws UnsupportedOperationException if the Entry is immutable or not supported
|
||||||
*/
|
*/
|
||||||
public VALUE_TYPE setValue(VALUE_TYPE value);
|
public VALUE_TYPE setValue(VALUE_TYPE value);
|
||||||
|
@Override
|
||||||
public default CLASS_VALUE_TYPE getValue() { return VALUE_TO_OBJ(ENTRY_VALUE()); }
|
public default CLASS_VALUE_TYPE getValue() { return VALUE_TO_OBJ(ENTRY_VALUE()); }
|
||||||
|
@Override
|
||||||
public default CLASS_VALUE_TYPE setValue(CLASS_VALUE_TYPE value) { return VALUE_TO_OBJ(setValue(OBJ_TO_VALUE(value))); }
|
public default CLASS_VALUE_TYPE setValue(CLASS_VALUE_TYPE value) { return VALUE_TO_OBJ(setValue(OBJ_TO_VALUE(value))); }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_BOOLEAN
|
#if !TYPE_BOOLEAN
|
||||||
|
/**
|
||||||
|
* Helper class that reduces the method spam of the Map Class.
|
||||||
|
*/
|
||||||
|
public static final class MapBuilder
|
||||||
|
{
|
||||||
|
static final MapBuilder INSTANCE = new MapBuilder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a Map Builder that allows you to create maps as Constants a lot easier
|
||||||
|
* Keys & Values are stored as Array and then inserted using the putAllMethod when the mapType is choosen
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a MapBuilder
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES BuilderCache KEY_VALUE_GENERIC_TYPE start() {
|
||||||
|
return new BuilderCache KEY_VALUE_GENERIC_TYPE();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a Map Builder that allows you to create maps as Constants a lot easier
|
||||||
|
* Keys & Values are stored as Array and then inserted using the putAllMethod when the mapType is choosen
|
||||||
|
* @param size the expected minimum size of Elements in the Map, default is 16
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a MapBuilder
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES BuilderCache KEY_VALUE_GENERIC_TYPE start(int size) {
|
||||||
|
return new BuilderCache KEY_VALUE_GENERIC_TYPE(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts a Map builder and puts in the Key & Value into it
|
||||||
|
* Keys & Values are stored as Array and then inserted using the putAllMethod when the mapType is choosen
|
||||||
|
* @param key the key that should be added
|
||||||
|
* @param value the value that should be added
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a MapBuilder with the key & value stored in it.
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES BuilderCache KEY_VALUE_GENERIC_TYPE put(KEY_TYPE key, VALUE_TYPE value) {
|
||||||
|
return new BuilderCache KEY_VALUE_GENERIC_TYPE().put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Starts a Map builder and puts in the Key & Value into it
|
||||||
|
* Keys & Values are stored as Array and then inserted using the putAllMethod when the mapType is choosen
|
||||||
|
* @param key the key that should be added
|
||||||
|
* @param value the value that should be added
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a MapBuilder with the key & value stored in it.
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES BuilderCache KEY_VALUE_GENERIC_TYPE put(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
|
return new BuilderCache KEY_VALUE_GENERIC_TYPE().put(key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a OpenHashMap
|
* @return a OpenHashMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap() {
|
public GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE map() {
|
||||||
return new HASH_MAPKV_BRACES();
|
return new HASH_MAPKV_BRACES();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -501,7 +636,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a OpenHashMap with a mimimum capacity
|
* @return a OpenHashMap with a mimimum capacity
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap(int size) {
|
public GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE map(int size) {
|
||||||
return new HASH_MAPKV_BRACES(size);
|
return new HASH_MAPKV_BRACES(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,11 +649,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a OpenHashMap thats contains the injected values
|
* @return a OpenHashMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
public GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE map(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
||||||
return new HASH_MAPKV_BRACES(keys, values);
|
return new HASH_MAPKV_BRACES(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -529,11 +664,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a OpenHashMap thats contains the injected values
|
* @return a OpenHashMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
public GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE map(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
return new HASH_MAPKV_BRACES(keys, values);
|
return new HASH_MAPKV_BRACES(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -541,7 +676,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a OpenHashMap thats copies the contents of the provided map
|
* @return a OpenHashMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap(MAP KEY_VALUE_GENERIC_TYPE map) {
|
public GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE map(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
return new HASH_MAPKV_BRACES(map);
|
return new HASH_MAPKV_BRACES(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -553,7 +688,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a OpenHashMap thats copies the contents of the provided map
|
* @return a OpenHashMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE createMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
public GENERIC_KEY_VALUE_BRACES HASH_MAP KEY_VALUE_GENERIC_TYPE map(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
return new HASH_MAPKV_BRACES(map);
|
return new HASH_MAPKV_BRACES(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -563,7 +698,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a LinkedOpenHashMap
|
* @return a LinkedOpenHashMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap() {
|
public GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap() {
|
||||||
return new LINKED_HASH_MAPKV_BRACES();
|
return new LINKED_HASH_MAPKV_BRACES();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +709,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a LinkedOpenHashMap with a mimimum capacity
|
* @return a LinkedOpenHashMap with a mimimum capacity
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap(int size) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap(int size) {
|
||||||
return new LINKED_HASH_MAPKV_BRACES(size);
|
return new LINKED_HASH_MAPKV_BRACES(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,11 +722,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a LinkedOpenHashMap thats contains the injected values
|
* @return a LinkedOpenHashMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
||||||
return new LINKED_HASH_MAPKV_BRACES(keys, values);
|
return new LINKED_HASH_MAPKV_BRACES(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -602,11 +737,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a LinkedOpenHashMap thats contains the injected values
|
* @return a LinkedOpenHashMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
return new LINKED_HASH_MAPKV_BRACES(keys, values);
|
return new LINKED_HASH_MAPKV_BRACES(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -614,7 +749,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a LinkedOpenHashMap thats copies the contents of the provided map
|
* @return a LinkedOpenHashMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap(MAP KEY_VALUE_GENERIC_TYPE map) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
return new LINKED_HASH_MAPKV_BRACES(map);
|
return new LINKED_HASH_MAPKV_BRACES(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -626,7 +761,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a LinkedOpenHashMap thats copies the contents of the provided map
|
* @return a LinkedOpenHashMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE createLinkedMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
public GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
return new IMMUTABLE_HASH_MAPKV_BRACES(map);
|
return new IMMUTABLE_HASH_MAPKV_BRACES(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -639,11 +774,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a ImmutableOpenHashMap thats contains the injected values
|
* @return a ImmutableOpenHashMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE createImmutable(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
public GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE immutable(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
||||||
return new IMMUTABLE_HASH_MAPKV_BRACES(keys, values);
|
return new IMMUTABLE_HASH_MAPKV_BRACES(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -654,11 +789,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a ImmutableOpenHashMap thats contains the injected values
|
* @return a ImmutableOpenHashMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE createImmutable(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
public GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE immutable(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
return new IMMUTABLE_HASH_MAPKV_BRACES(keys, values);
|
return new IMMUTABLE_HASH_MAPKV_BRACES(keys, values);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -666,7 +801,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a ImmutableOpenHashMap thats copies the contents of the provided map
|
* @return a ImmutableOpenHashMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE createImmutable(MAP KEY_VALUE_GENERIC_TYPE map) {
|
public GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE immutable(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
return new IMMUTABLE_HASH_MAPKV_BRACES(map);
|
return new IMMUTABLE_HASH_MAPKV_BRACES(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,10 +813,145 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a ImmutableOpenHashMap thats copies the contents of the provided map
|
* @return a ImmutableOpenHashMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE createImmutable(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
public GENERIC_KEY_VALUE_BRACES IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE immutable(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
return new IMMUTABLE_HASH_MAPKV_BRACES(map);
|
return new IMMUTABLE_HASH_MAPKV_BRACES(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keyType the EnumClass that should be used
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a Empty EnumMap
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap(Class<T> keyType) {
|
||||||
|
return new ENUM_MAPKV_BRACES(keyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keys the keys that should be inserted
|
||||||
|
* @param values the values that should be inserted
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
|
* @throws IllegalArgumentException if the keys are in length 0
|
||||||
|
* @return a EnumMap thats contains the injected values
|
||||||
|
* @note the keys and values will be unboxed
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
|
return new ENUM_MAPKV_BRACES(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keys the keys that should be inserted
|
||||||
|
* @param values the values that should be inserted
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
|
* @throws IllegalArgumentException if the keys are in length 0
|
||||||
|
* @return a EnumMap thats contains the injected values
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
||||||
|
return new ENUM_MAPKV_BRACES(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param map that should be cloned
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a EnumMap thats copies the contents of the provided map
|
||||||
|
* @throws IllegalArgumentException if the map is Empty and is not a EnumMap
|
||||||
|
* @note the map will be unboxed
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
|
return new ENUM_MAPKV_BRACES(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param map that should be cloned
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalArgumentException if the map is Empty and is not a EnumMap
|
||||||
|
* @return a EnumMap thats copies the contents of the provided map
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES ENUM_MAP KEY_VALUE_GENERIC_TYPE enumMap(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
|
return new ENUM_MAPKV_BRACES(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keyType the EnumClass that should be used
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a Empty LinkedEnumMap
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE linkedEnumMap(Class<T> keyType) {
|
||||||
|
return new LINKED_ENUM_MAPKV_BRACES(keyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keys the keys that should be inserted
|
||||||
|
* @param values the values that should be inserted
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
|
* @throws IllegalArgumentException if the keys are in length 0
|
||||||
|
* @return a LinkedEnumMap thats contains the injected values
|
||||||
|
* @note the keys and values will be unboxed
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE linkedEnumMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
|
return new LINKED_ENUM_MAPKV_BRACES(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keys the keys that should be inserted
|
||||||
|
* @param values the values that should be inserted
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
|
* @throws IllegalArgumentException if the keys are in length 0
|
||||||
|
* @return a LinkedEnumMap thats contains the injected values
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE linkedEnumMap(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
||||||
|
return new LINKED_ENUM_MAPKV_BRACES(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param map that should be cloned
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a LinkedEnumMap thats copies the contents of the provided map
|
||||||
|
* @throws IllegalArgumentException if the map is Empty and is not a EnumMap
|
||||||
|
* @note the map will be unboxed
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_ENUM_VALUE_BRACES LINKED_ENUM_MAP KEY_VALUE_GENERIC_TYPE linkedEnumMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
|
return new LINKED_ENUM_MAPKV_BRACES(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param map that should be cloned
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalArgumentException if the map is Empty and is not a EnumMap
|
||||||
|
* @return a LinkedEnumMap thats copies the contents of the provided 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);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param strategy the Hash Controller
|
* @param strategy the Hash Controller
|
||||||
|
@ -689,7 +959,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a CustomOpenHashMap
|
* @return a CustomOpenHashMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new CUSTOM_HASH_MAPKV_BRACES(strategy);
|
return new CUSTOM_HASH_MAPKV_BRACES(strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,7 +971,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a CustomOpenHashMap with a mimimum capacity
|
* @return a CustomOpenHashMap with a mimimum capacity
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(int size, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(int size, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new CUSTOM_HASH_MAPKV_BRACES(size, strategy);
|
return new CUSTOM_HASH_MAPKV_BRACES(size, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -715,11 +985,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a CustomOpenHashMap thats contains the injected values
|
* @return a CustomOpenHashMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(KEY_TYPE[] keys, VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(KEY_TYPE[] keys, VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
return new CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -731,11 +1001,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a CustomOpenHashMap thats contains the injected values
|
* @return a CustomOpenHashMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
return new CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -744,7 +1014,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a CustomOpenHashMap thats copies the contents of the provided map
|
* @return a CustomOpenHashMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(MAP KEY_VALUE_GENERIC_TYPE map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(MAP KEY_VALUE_GENERIC_TYPE map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
return new CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,7 +1027,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a CustomOpenHashMap thats copies the contents of the provided map
|
* @return a CustomOpenHashMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
return new CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -768,7 +1038,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a CustomLinkedOpenHashMap
|
* @return a CustomLinkedOpenHashMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(strategy);
|
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -780,7 +1050,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a CustomLinkedOpenHashMap with a mimimum capacity
|
* @return a CustomLinkedOpenHashMap with a mimimum capacity
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(int size, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(int size, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy);
|
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -794,11 +1064,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a CustomLinkedOpenHashMap thats contains the injected values
|
* @return a CustomLinkedOpenHashMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(KEY_TYPE[] keys, VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(KEY_TYPE[] keys, VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -810,11 +1080,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a CustomLinkedOpenHashMap thats contains the injected values
|
* @return a CustomLinkedOpenHashMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(keys, values, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -823,7 +1093,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a CustomLinkedOpenHashMap thats copies the contents of the provided map
|
* @return a CustomLinkedOpenHashMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(MAP KEY_VALUE_GENERIC_TYPE map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(MAP KEY_VALUE_GENERIC_TYPE map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -836,17 +1106,91 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a CustomLinkedOpenHashMap thats copies the contents of the provided map
|
* @return a CustomLinkedOpenHashMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE createCustomLinkedMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
public GENERIC_KEY_VALUE_BRACES LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
return new LINKED_CUSTOM_HASH_MAPKV_BRACES(map, strategy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a OpenHashMap
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap() {
|
||||||
|
return new ARRAY_MAPKV_BRACES();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param size the minimum capacity of the Map
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a OpenHashMap with a mimimum capacity
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap(int size) {
|
||||||
|
return new ARRAY_MAPKV_BRACES(size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keys the keys that should be inserted
|
||||||
|
* @param values the values that should be inserted
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
|
* @return a OpenHashMap thats contains the injected values
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap(KEY_TYPE[] keys, VALUE_TYPE[] values) {
|
||||||
|
return new ARRAY_MAPKV_BRACES(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param keys the keys that should be inserted
|
||||||
|
* @param values the values that should be inserted
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
|
* @return a OpenHashMap thats contains the injected values
|
||||||
|
* @note the keys and values will be unboxed
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values) {
|
||||||
|
return new ARRAY_MAPKV_BRACES(keys, values);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param map that should be cloned
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a OpenHashMap thats copies the contents of the provided map
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
|
return new ARRAY_MAPKV_BRACES(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to unify code
|
||||||
|
* @param map that should be cloned
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
* @return a OpenHashMap thats copies the contents of the provided map
|
||||||
|
* @note the map will be unboxed
|
||||||
|
*/
|
||||||
|
public GENERIC_KEY_VALUE_BRACES ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
|
return new ARRAY_MAPKV_BRACES(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a RBTreeMap
|
* @return a RBTreeMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap() {
|
public GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap() {
|
||||||
return new RB_TREE_MAPKV_BRACES();
|
return new RB_TREE_MAPKV_BRACES();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -857,7 +1201,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a RBTreeMap
|
* @return a RBTreeMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new RB_TREE_MAPKV_BRACES(comp);
|
return new RB_TREE_MAPKV_BRACES(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -871,11 +1215,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a RBTreeMap thats contains the injected values
|
* @return a RBTreeMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap(KEY_TYPE[] keys, VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap(KEY_TYPE[] keys, VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new RB_TREE_MAPKV_BRACES(keys, values, comp);
|
return new RB_TREE_MAPKV_BRACES(keys, values, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -887,11 +1231,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a RBTreeMap thats contains the injected values
|
* @return a RBTreeMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new RB_TREE_MAPKV_BRACES(keys, values, comp);
|
return new RB_TREE_MAPKV_BRACES(keys, values, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -900,7 +1244,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a RBTreeMap thats copies the contents of the provided map
|
* @return a RBTreeMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap(MAP KEY_VALUE_GENERIC_TYPE map, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap(MAP KEY_VALUE_GENERIC_TYPE map, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new RB_TREE_MAPKV_BRACES(map, comp);
|
return new RB_TREE_MAPKV_BRACES(map, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -913,7 +1257,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a RBTreeMap thats copies the contents of the provided map
|
* @return a RBTreeMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE createRBTreeMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new RB_TREE_MAPKV_BRACES(map, comp);
|
return new RB_TREE_MAPKV_BRACES(map, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -923,7 +1267,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a AVLTreeMap
|
* @return a AVLTreeMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap() {
|
public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap() {
|
||||||
return new AVL_TREE_MAPKV_BRACES();
|
return new AVL_TREE_MAPKV_BRACES();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -934,7 +1278,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a AVLTreeMap
|
* @return a AVLTreeMap
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new AVL_TREE_MAPKV_BRACES(comp);
|
return new AVL_TREE_MAPKV_BRACES(comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -948,11 +1292,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @throws IllegalStateException if the keys and values do not match in length
|
* @throws IllegalStateException if the keys and values do not match in length
|
||||||
* @return a AVLTreeMap thats contains the injected values
|
* @return a AVLTreeMap thats contains the injected values
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap(KEY_TYPE[] keys, VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(KEY_TYPE[] keys, VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new AVL_TREE_MAPKV_BRACES(keys, values, comp);
|
return new AVL_TREE_MAPKV_BRACES(keys, values, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
/**
|
/**
|
||||||
* 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
|
||||||
|
@ -964,11 +1308,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a AVLTreeMap thats contains the injected values
|
* @return a AVLTreeMap thats contains the injected values
|
||||||
* @note the keys and values will be unboxed
|
* @note the keys and values will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(CLASS_TYPE[] keys, CLASS_VALUE_TYPE[] values, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new AVL_TREE_MAPKV_BRACES(keys, values, comp);
|
return new AVL_TREE_MAPKV_BRACES(keys, values, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* Helper function to unify code
|
* Helper function to unify code
|
||||||
* @param map that should be cloned
|
* @param map that should be cloned
|
||||||
|
@ -977,7 +1321,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @ValueType(V)
|
* @ValueType(V)
|
||||||
* @return a AVLTreeMap thats copies the contents of the provided map
|
* @return a AVLTreeMap thats copies the contents of the provided map
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap(MAP KEY_VALUE_GENERIC_TYPE map, COMPARATOR KEY_GENERIC_TYPE comp) {
|
public GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(MAP KEY_VALUE_GENERIC_TYPE map, COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
return new AVL_TREE_MAPKV_BRACES(map, comp);
|
return new AVL_TREE_MAPKV_BRACES(map, comp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -990,9 +1334,203 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
* @return a AVLTreeMap thats copies the contents of the provided map
|
* @return a AVLTreeMap thats copies the contents of the provided map
|
||||||
* @note the map will be unboxed
|
* @note the map will be unboxed
|
||||||
*/
|
*/
|
||||||
public static GENERIC_KEY_VALUE_BRACES AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE createAVLTreeMap(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);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder Cache for allowing to buildMaps
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
|
public static class BuilderCache KEY_VALUE_GENERIC_TYPE
|
||||||
|
{
|
||||||
|
KEY_TYPE[] keys;
|
||||||
|
VALUE_TYPE[] values;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default Constructor
|
||||||
|
*/
|
||||||
|
public BuilderCache() {
|
||||||
|
this(HashUtil.DEFAULT_MIN_CAPACITY);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor providing a Minimum Capcity
|
||||||
|
* @param initialSize the requested start capacity
|
||||||
|
*/
|
||||||
|
public BuilderCache(int initialSize) {
|
||||||
|
keys = NEW_KEY_ARRAY(initialSize);
|
||||||
|
values = NEW_VALUE_ARRAY(initialSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ensureSize(int newSize) {
|
||||||
|
if(keys.length >= newSize) return;
|
||||||
|
newSize = (int)Math.max(Math.min((long)keys.length + (keys.length >> 1), SanityChecks.MAX_ARRAY_SIZE), newSize);
|
||||||
|
keys = Arrays.copyOf(keys, newSize);
|
||||||
|
values = Arrays.copyOf(values, newSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to add a Entry into the Map
|
||||||
|
* @param key the key that should be added
|
||||||
|
* @param value the value that should be added
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public BuilderCache KEY_VALUE_GENERIC_TYPE put(KEY_TYPE key, VALUE_TYPE value) {
|
||||||
|
ensureSize(size+1);
|
||||||
|
keys[size] = key;
|
||||||
|
values[size] = value;
|
||||||
|
size++;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Helper function to add a Entry into the Map
|
||||||
|
* @param key the key that should be added
|
||||||
|
* @param value the value that should be added
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public BuilderCache KEY_VALUE_GENERIC_TYPE put(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
|
return put(OBJ_TO_KEY(key), OBJ_TO_VALUE(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Helper function to add a Entry into the Map
|
||||||
|
* @param entry the Entry that should be added
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public BuilderCache KEY_VALUE_GENERIC_TYPE put(MAP.Entry KEY_VALUE_GENERIC_TYPE entry) {
|
||||||
|
return put(entry.ENTRY_KEY(), entry.ENTRY_VALUE());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to add a Map to the Map
|
||||||
|
* @param map that should be added
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public BuilderCache KEY_VALUE_GENERIC_TYPE putAll(MAP KEY_VALUE_GENERIC_TYPE map) {
|
||||||
|
return putAll(MAPS.fastIterable(map));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to add a Map to the Map
|
||||||
|
* @param map that should be added
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public BuilderCache KEY_VALUE_GENERIC_TYPE putAll(Map<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> map) {
|
||||||
|
for(Map.Entry<? extends CLASS_TYPE, ? extends CLASS_VALUE_TYPE> entry : map.entrySet())
|
||||||
|
put(entry.getKey(), entry.getValue());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to add a Collection of Entries to the Map
|
||||||
|
* @param c that should be added
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public BuilderCache KEY_VALUE_GENERIC_TYPE putAll(ObjectIterable<MAP.Entry KEY_VALUE_GENERIC_TYPE> c) {
|
||||||
|
if(c instanceof Collection)
|
||||||
|
ensureSize(size+((Collection<MAP.Entry KEY_VALUE_GENERIC_TYPE>)c).size());
|
||||||
|
|
||||||
|
for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : c)
|
||||||
|
put(entry);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
private <E extends MAP KEY_VALUE_GENERIC_TYPE> E putElements(E e){
|
||||||
|
e.putAll(keys, values, 0, size);
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a Hash Map
|
||||||
|
* @return a HASH_MAP
|
||||||
|
*/
|
||||||
|
public HASH_MAP KEY_VALUE_GENERIC_TYPE map() {
|
||||||
|
return putElements(new HASH_MAPKV_BRACES(size));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a Linked Hash Map
|
||||||
|
* @return a LINKED_HASH_MAP
|
||||||
|
*/
|
||||||
|
public LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE linkedMap() {
|
||||||
|
return putElements(new LINKED_HASH_MAPKV_BRACES(size));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a Immutable Hash Map
|
||||||
|
* @return a IMMUTABLE_HASH_MAP
|
||||||
|
*/
|
||||||
|
public IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE immutable() {
|
||||||
|
return new IMMUTABLE_HASH_MAPKV_BRACES(Arrays.copyOf(keys, size), Arrays.copyOf(values, size));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a Custom Hash Map
|
||||||
|
* @param strategy the that controls the keys & values
|
||||||
|
* @return a CUSTOM_HASH_MAP
|
||||||
|
*/
|
||||||
|
public CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customMap(STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
|
return putElements(new CUSTOM_HASH_MAPKV_BRACES(size, strategy));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a Linked Custom Hash Map
|
||||||
|
* @param strategy the that controls the keys & values
|
||||||
|
* @return a LINKED_CUSTOM_HASH_MAP
|
||||||
|
*/
|
||||||
|
public LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE customLinkedMap(STRATEGY KEY_GENERIC_TYPE strategy) {
|
||||||
|
return putElements(new LINKED_CUSTOM_HASH_MAPKV_BRACES(size, strategy));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a Array Map
|
||||||
|
* @return a ARRAY_MAP
|
||||||
|
*/
|
||||||
|
public ARRAY_MAP KEY_VALUE_GENERIC_TYPE arrayMap() {
|
||||||
|
return new ARRAY_MAPKV_BRACES(keys, values, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a RedBlack TreeMap
|
||||||
|
* @return a RB_TREE_MAP
|
||||||
|
*/
|
||||||
|
public RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap() {
|
||||||
|
return putElements(new RB_TREE_MAPKV_BRACES());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a RedBlack TreeMap
|
||||||
|
* @param comp the Comparator that sorts the Tree
|
||||||
|
* @return a RB_TREE_MAP
|
||||||
|
*/
|
||||||
|
public RB_TREE_MAP KEY_VALUE_GENERIC_TYPE rbTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
|
return putElements(new RB_TREE_MAPKV_BRACES(comp));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a AVL TreeMap
|
||||||
|
* @return a AVL_TREE_MAP
|
||||||
|
*/
|
||||||
|
public AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap() {
|
||||||
|
return putElements(new AVL_TREE_MAPKV_BRACES());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the Keys & Values into a AVL TreeMap
|
||||||
|
* @param comp the Comparator that sorts the Tree
|
||||||
|
* @return a AVL_TREE_MAP
|
||||||
|
*/
|
||||||
|
public AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE avlTreeMap(COMPARATOR KEY_GENERIC_TYPE comp) {
|
||||||
|
return putElements(new AVL_TREE_MAPKV_BRACES(comp));
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
|
@ -2,6 +2,7 @@ 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;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific Navigable Map interface with a couple helper methods
|
* A Type Specific Navigable Map interface with a couple helper methods
|
||||||
|
@ -34,6 +35,28 @@ public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VAL
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry();
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped NavigableMap that is Synchronized
|
||||||
|
* @return a new NavigableMap that is synchronized
|
||||||
|
* @see MAPS#synchronize
|
||||||
|
*/
|
||||||
|
public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronize() { return MAPS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped NavigableMap that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new NavigableMap Wrapper that is synchronized
|
||||||
|
* @see MAPS#synchronize
|
||||||
|
*/
|
||||||
|
public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronize(Object mutex) { return MAPS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped NavigableMap that is unmodifiable
|
||||||
|
* @return a new NavigableMap Wrapper that is unmodifiable
|
||||||
|
* @see MAPS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
/**
|
/**
|
||||||
* A Type Specific SubMap method to reduce boxing/unboxing
|
* A Type Specific SubMap method to reduce boxing/unboxing
|
||||||
|
|
|
@ -10,6 +10,7 @@ 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.SET;
|
import speiger.src.collections.PACKAGE.sets.SET;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
|
||||||
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
||||||
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
|
|
||||||
|
@ -83,6 +84,28 @@ 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();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped SortedMap that is Synchronized
|
||||||
|
* @return a new SortedMap that is synchronized
|
||||||
|
* @see MAPS#synchronize
|
||||||
|
*/
|
||||||
|
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronize() { return MAPS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped SortedMap that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new SortedMap Wrapper that is synchronized
|
||||||
|
* @see MAPS#synchronize
|
||||||
|
*/
|
||||||
|
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronize(Object mutex) { return MAPS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped SortedMap that is unmodifiable
|
||||||
|
* @return a new SortedMap Wrapper that is unmodifiable
|
||||||
|
* @see MAPS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); }
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
/**
|
/**
|
||||||
* A Type Specific SubMap method to reduce boxing/unboxing
|
* A Type Specific SubMap method to reduce boxing/unboxing
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Iterator;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.PRIORITY_QUEUES;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type Speciifc PriorityDeque or Dequeue interface to allow implementations like FIFO queues.
|
* A Type Speciifc PriorityDeque or Dequeue interface to allow implementations like FIFO queues.
|
||||||
|
@ -80,6 +81,21 @@ public interface PRIORITY_DEQUEUE KEY_GENERIC_TYPE extends PRIORITY_QUEUE KEY_GE
|
||||||
*/
|
*/
|
||||||
public default KEY_TYPE last() { return peek(size()-1); }
|
public default KEY_TYPE last() { return peek(size()-1); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped PriorityDequeue that is Synchronized
|
||||||
|
* @return a new PriorityDequeue that is synchronized
|
||||||
|
* @see PRIORITY_QUEUES#synchronize
|
||||||
|
*/
|
||||||
|
public default PRIORITY_DEQUEUE KEY_GENERIC_TYPE synchronizeQueue() { return PRIORITY_QUEUES.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped PriorityDequeue that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new PriorityDequeue Wrapper that is synchronized
|
||||||
|
* @see PRIORITY_QUEUES#synchronize
|
||||||
|
*/
|
||||||
|
public default PRIORITY_DEQUEUE KEY_GENERIC_TYPE synchronizeQueue(Object mutex) { return PRIORITY_QUEUES.synchronize(this, mutex); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy();
|
public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy();
|
||||||
}
|
}
|
|
@ -4,12 +4,16 @@ package speiger.src.collections.PACKAGE.queues;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import speiger.src.collections.ints.functions.function.Int2ObjectFunction;
|
||||||
#else
|
#else
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
#endif
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERABLE;
|
import speiger.src.collections.PACKAGE.collections.ITERABLE;
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.PRIORITY_QUEUES;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Simple PriorityQueue (or Queue) interface that provides with the nessesary functions to interact with it, without cluttering with the Collection interface.
|
* A Simple PriorityQueue (or Queue) interface that provides with the nessesary functions to interact with it, without cluttering with the Collection interface.
|
||||||
|
@ -144,6 +148,22 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY
|
||||||
*/
|
*/
|
||||||
public ITERATOR KEY_GENERIC_TYPE iterator();
|
public ITERATOR KEY_GENERIC_TYPE iterator();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped PriorityQueue that is Synchronized
|
||||||
|
* @return a new PriorityQueue that is synchronized
|
||||||
|
* @see PRIORITY_QUEUES#synchronize
|
||||||
|
*/
|
||||||
|
public default PRIORITY_QUEUE KEY_GENERIC_TYPE synchronizeQueue() { return PRIORITY_QUEUES.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped PriorityQueue that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new PriorityQueue Wrapper that is synchronized
|
||||||
|
* @see PRIORITY_QUEUES#synchronize
|
||||||
|
*/
|
||||||
|
public default PRIORITY_QUEUE KEY_GENERIC_TYPE synchronizeQueue(Object mutex) { return PRIORITY_QUEUES.synchronize(this, mutex); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A method to drop the contents of the Queue without clearing the queue
|
* A method to drop the contents of the Queue without clearing the queue
|
||||||
* @Type(E)
|
* @Type(E)
|
||||||
|
@ -158,4 +178,15 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY
|
||||||
* @note if the Type is generic then a Object Array is created instead of a Type Array
|
* @note if the Type is generic then a Object Array is created instead of a Type Array
|
||||||
*/
|
*/
|
||||||
public GENERIC_SPECIAL_KEY_BRACES<E> KEY_SPECIAL_TYPE[] TO_ARRAY(KEY_SPECIAL_TYPE[] input);
|
public GENERIC_SPECIAL_KEY_BRACES<E> KEY_SPECIAL_TYPE[] TO_ARRAY(KEY_SPECIAL_TYPE[] input);
|
||||||
|
#if TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* A Helper function that simplifies the process of creating a new Array.
|
||||||
|
* @param action the array creation function
|
||||||
|
* @return an array containing all of the elements in this collection
|
||||||
|
* @see Collection#toArray(Object[])
|
||||||
|
*/
|
||||||
|
default KEY_TYPE[] TO_ARRAY(Int2ObjectFunction<KEY_TYPE[]> action) {
|
||||||
|
return TO_ARRAY(action.get(size()));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ import java.util.NavigableSet;
|
||||||
|
|
||||||
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
||||||
|
import speiger.src.collections.PACKAGE.utils.SETS;
|
||||||
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -118,6 +119,30 @@ public interface NAVIGABLE_SET KEY_GENERIC_TYPE extends NavigableSet<CLASS_TYPE>
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE copy();
|
public NAVIGABLE_SET KEY_GENERIC_TYPE copy();
|
||||||
|
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped NavigableSet that is Synchronized
|
||||||
|
* @return a new NavigableSet that is synchronized
|
||||||
|
* @see SETS#synchronize
|
||||||
|
*/
|
||||||
|
public default NAVIGABLE_SET KEY_GENERIC_TYPE synchronize() { return SETS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped NavigableSet that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new NavigableSet Wrapper that is synchronized
|
||||||
|
* @see SETS#synchronize
|
||||||
|
*/
|
||||||
|
public default NAVIGABLE_SET KEY_GENERIC_TYPE synchronize(Object mutex) { return SETS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped NavigableSet that is unmodifiable
|
||||||
|
* @return a new NavigableSet Wrapper that is unmodifiable
|
||||||
|
* @see SETS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default NAVIGABLE_SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
||||||
* @return type specific splititerator
|
* @return type specific splititerator
|
||||||
|
|
|
@ -5,8 +5,12 @@ import java.util.Set;
|
||||||
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
import speiger.src.collections.PACKAGE.utils.SETS;
|
||||||
|
#endif
|
||||||
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Type Specific Set class to reduce boxing/unboxing
|
* A Type Specific Set class to reduce boxing/unboxing
|
||||||
* @Type(T)
|
* @Type(T)
|
||||||
|
@ -49,6 +53,31 @@ public interface SET KEY_GENERIC_TYPE extends Set<CLASS_TYPE>, COLLECTION KEY_GE
|
||||||
public default boolean remove(Object o) {
|
public default boolean remove(Object o) {
|
||||||
return COLLECTION.super.remove(o);
|
return COLLECTION.super.remove(o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Set that is Synchronized
|
||||||
|
* @return a new Set that is synchronized
|
||||||
|
* @see SETS#synchronize
|
||||||
|
*/
|
||||||
|
public default SET KEY_GENERIC_TYPE synchronize() { return SETS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Set that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new Set Wrapper that is synchronized
|
||||||
|
* @see SETS#synchronize
|
||||||
|
*/
|
||||||
|
public default SET KEY_GENERIC_TYPE synchronize(Object mutex) { return SETS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped Set that is unmodifiable
|
||||||
|
* @return a new Set Wrapper that is unmodifiable
|
||||||
|
* @see SETS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
/**
|
/**
|
||||||
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
||||||
|
|
|
@ -9,6 +9,7 @@ import java.util.Comparator;
|
||||||
#else
|
#else
|
||||||
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
|
||||||
#endif
|
#endif
|
||||||
|
import speiger.src.collections.PACKAGE.utils.SETS;
|
||||||
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,6 +74,30 @@ public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, Sorte
|
||||||
*/
|
*/
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement);
|
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement);
|
||||||
|
|
||||||
|
#if !TYPE_BOOLEAN
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped SortedSet that is Synchronized
|
||||||
|
* @return a new SortedSet that is synchronized
|
||||||
|
* @see SETS#synchronize
|
||||||
|
*/
|
||||||
|
public default SORTED_SET KEY_GENERIC_TYPE synchronize() { return SETS.synchronize(this); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped SortedSet that is Synchronized
|
||||||
|
* @param mutex is the controller of the synchronization block
|
||||||
|
* @return a new SortedSet Wrapper that is synchronized
|
||||||
|
* @see SETS#synchronize
|
||||||
|
*/
|
||||||
|
public default SORTED_SET KEY_GENERIC_TYPE synchronize(Object mutex) { return SETS.synchronize(this, mutex); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a Wrapped SortedSet that is unmodifiable
|
||||||
|
* @return a new SortedSet Wrapper that is unmodifiable
|
||||||
|
* @see SETS#unmodifiable
|
||||||
|
*/
|
||||||
|
public default SORTED_SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
|
||||||
|
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
* A Type Specific Type Splititerator to reduce boxing/unboxing
|
||||||
* @return type specific splititerator
|
* @return type specific splititerator
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class COLLECTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public COLLECTION KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public COLLECTION KEY_GENERIC_TYPE copy() { synchronized(mutex) { return c.copy(); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Primitive
|
@Primitive
|
||||||
|
@ -254,7 +254,7 @@ public class COLLECTIONS
|
||||||
@Override
|
@Override
|
||||||
public ITERATOR KEY_GENERIC_TYPE iterator() { return ITERATORS.unmodifiable(c.iterator()); }
|
public ITERATOR KEY_GENERIC_TYPE iterator() { return ITERATORS.unmodifiable(c.iterator()); }
|
||||||
@Override
|
@Override
|
||||||
public COLLECTION KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public COLLECTION KEY_GENERIC_TYPE copy() { return c.copy(); }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public boolean remove(Object o) { throw new UnsupportedOperationException(); }
|
public boolean remove(Object o) { throw new UnsupportedOperationException(); }
|
||||||
|
|
|
@ -388,14 +388,14 @@ public class LISTS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LIST KEY_GENERIC_TYPE subList(int from, int to) {
|
public LIST KEY_GENERIC_TYPE subList(int from, int to) {
|
||||||
return synchronize(l.subList(from, to));
|
return LISTS.synchronize(l.subList(from, to));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void size(int size) { synchronized(mutex) { l.size(size); } }
|
public void size(int size) { synchronized(mutex) { l.size(size); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LIST KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public LIST KEY_GENERIC_TYPE copy() { synchronized(mutex) { return l.copy(); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class UnmodifiableRandomList KEY_GENERIC_TYPE extends UnmodifiableList KEY_GENERIC_TYPE implements RandomAccess
|
private static class UnmodifiableRandomList KEY_GENERIC_TYPE extends UnmodifiableList KEY_GENERIC_TYPE implements RandomAccess
|
||||||
|
@ -510,14 +510,14 @@ public class LISTS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LIST KEY_GENERIC_TYPE subList(int from, int to) {
|
public LIST KEY_GENERIC_TYPE subList(int from, int to) {
|
||||||
return unmodifiable(l.subList(from, to));
|
return LISTS.unmodifiable(l.subList(from, to));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void size(int size) { throw new UnsupportedOperationException(); }
|
public void size(int size) { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LIST KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public LIST KEY_GENERIC_TYPE copy() { return l.copy(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class EmptyList KEY_GENERIC_TYPE extends COLLECTIONS.EmptyCollection KEY_GENERIC_TYPE implements LIST KEY_GENERIC_TYPE
|
private static class EmptyList KEY_GENERIC_TYPE extends COLLECTIONS.EmptyCollection KEY_GENERIC_TYPE implements LIST KEY_GENERIC_TYPE
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class PRIORITY_QUEUES
|
||||||
@Override
|
@Override
|
||||||
public GENERIC_SPECIAL_KEY_BRACES<E> KEY_SPECIAL_TYPE[] TO_ARRAY(KEY_SPECIAL_TYPE[] input) { synchronized(mutex) { return queue.TO_ARRAY(input); } }
|
public GENERIC_SPECIAL_KEY_BRACES<E> KEY_SPECIAL_TYPE[] TO_ARRAY(KEY_SPECIAL_TYPE[] input) { synchronized(mutex) { return queue.TO_ARRAY(input); } }
|
||||||
@Override
|
@Override
|
||||||
public PRIORITY_QUEUE KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public PRIORITY_QUEUE KEY_GENERIC_TYPE copy() { synchronized(mutex) { return queue.copy(); } }
|
||||||
@Override
|
@Override
|
||||||
public void forEach(CONSUMER KEY_SUPER_GENERIC_TYPE action) { synchronized(mutex) { queue.forEach(action); } }
|
public void forEach(CONSUMER KEY_SUPER_GENERIC_TYPE action) { synchronized(mutex) { queue.forEach(action); } }
|
||||||
@Override
|
@Override
|
||||||
|
@ -164,6 +164,6 @@ public class PRIORITY_QUEUES
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE dequeueLast() { synchronized(mutex) { return dequeue.dequeueLast(); } }
|
public KEY_TYPE dequeueLast() { synchronized(mutex) { return dequeue.dequeueLast(); } }
|
||||||
@Override
|
@Override
|
||||||
public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy() { synchronized(mutex) { return dequeue.copy(); } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,28 +254,28 @@ public class SETS
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, boolean fromInclusive, KEY_TYPE toElement, boolean toInclusive) { return unmodifiable(n.subSet(fromElement, fromInclusive, toElement, toInclusive)); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, boolean fromInclusive, KEY_TYPE toElement, boolean toInclusive) { return SETS.unmodifiable(n.subSet(fromElement, fromInclusive, toElement, toInclusive)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement, boolean inclusive) { return unmodifiable(n.headSet(toElement, inclusive)); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement, boolean inclusive) { return SETS.unmodifiable(n.headSet(toElement, inclusive)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement, boolean inclusive) { return unmodifiable(n.tailSet(fromElement, inclusive)); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement, boolean inclusive) { return SETS.unmodifiable(n.tailSet(fromElement, inclusive)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE descendingIterator() { return ITERATORS.unmodifiable(n.descendingIterator()); }
|
public BI_ITERATOR KEY_GENERIC_TYPE descendingIterator() { return ITERATORS.unmodifiable(n.descendingIterator()); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingSet() { return unmodifiable(n.descendingSet()); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingSet() { return SETS.unmodifiable(n.descendingSet()); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { return unmodifiable(n.subSet(fromElement, toElement)); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { return SETS.unmodifiable(n.subSet(fromElement, toElement)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { return unmodifiable(n.headSet(toElement)); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { return SETS.unmodifiable(n.headSet(toElement)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { return unmodifiable(n.tailSet(fromElement)); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { return SETS.unmodifiable(n.tailSet(fromElement)); }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class UnmodifiableSortedSet KEY_GENERIC_TYPE extends UnmodifiableSet KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE
|
private static class UnmodifiableSortedSet KEY_GENERIC_TYPE extends UnmodifiableSet KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE
|
||||||
|
@ -309,16 +309,16 @@ public class SETS
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { return ITERATORS.unmodifiable(s.iterator(fromElement)); }
|
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { return ITERATORS.unmodifiable(s.iterator(fromElement)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public SORTED_SET KEY_GENERIC_TYPE copy() { return s.copy(); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { return unmodifiable(s.subSet(fromElement, toElement)); }
|
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { return SETS.unmodifiable(s.subSet(fromElement, toElement)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { return unmodifiable(s.headSet(toElement)); }
|
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { return SETS.unmodifiable(s.headSet(toElement)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { return unmodifiable(s.tailSet(fromElement)); }
|
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { return SETS.unmodifiable(s.tailSet(fromElement)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE FIRST_KEY() { return s.FIRST_KEY(); }
|
public KEY_TYPE FIRST_KEY() { return s.FIRST_KEY(); }
|
||||||
|
@ -348,7 +348,7 @@ public class SETS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public SET KEY_GENERIC_TYPE copy() { return s.copy(); }
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
|
@ -427,31 +427,31 @@ public class SETS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE copy() { synchronized(mutex) { return n.copy(); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, boolean fromInclusive, KEY_TYPE toElement, boolean toInclusive) { synchronized(mutex) { return synchronize(n.subSet(fromElement, fromInclusive, toElement, toInclusive), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, boolean fromInclusive, KEY_TYPE toElement, boolean toInclusive) { synchronized(mutex) { return SETS.synchronize(n.subSet(fromElement, fromInclusive, toElement, toInclusive), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement, boolean inclusive) { synchronized(mutex) { return synchronize(n.headSet(toElement, inclusive), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement, boolean inclusive) { synchronized(mutex) { return SETS.synchronize(n.headSet(toElement, inclusive), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement, boolean inclusive) { synchronized(mutex) { return synchronize(n.tailSet(fromElement, inclusive), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement, boolean inclusive) { synchronized(mutex) { return SETS.synchronize(n.tailSet(fromElement, inclusive), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE descendingIterator() { synchronized(mutex) { return n.descendingIterator(); } }
|
public BI_ITERATOR KEY_GENERIC_TYPE descendingIterator() { synchronized(mutex) { return n.descendingIterator(); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingSet() { synchronized(mutex) { return synchronize(n.descendingSet(), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingSet() { synchronized(mutex) { return SETS.synchronize(n.descendingSet(), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return synchronize(n.subSet(fromElement, toElement), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return SETS.synchronize(n.subSet(fromElement, toElement), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return synchronize(n.headSet(toElement), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return SETS.synchronize(n.headSet(toElement), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return synchronize(n.tailSet(fromElement), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return SETS.synchronize(n.tailSet(fromElement), mutex); } }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class SynchronizedSortedTrimSet KEY_GENERIC_TYPE extends SynchronizedSortedSet KEY_GENERIC_TYPE implements ITrimmable
|
private static class SynchronizedSortedTrimSet KEY_GENERIC_TYPE extends SynchronizedSortedSet KEY_GENERIC_TYPE implements ITrimmable
|
||||||
|
@ -511,16 +511,16 @@ public class SETS
|
||||||
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { synchronized(mutex) { return s.iterator(fromElement); } }
|
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { synchronized(mutex) { return s.iterator(fromElement); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public SORTED_SET KEY_GENERIC_TYPE copy() { synchronized(mutex) { return s.copy(); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return synchronize(s.subSet(fromElement, toElement), mutex); } }
|
public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return SETS.synchronize(s.subSet(fromElement, toElement), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return synchronize(s.headSet(toElement), mutex); } }
|
public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return SETS.synchronize(s.headSet(toElement), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return synchronize(s.tailSet(fromElement), mutex); } }
|
public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return SETS.synchronize(s.tailSet(fromElement), mutex); } }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE FIRST_KEY() { synchronized(mutex) { return s.FIRST_KEY(); } }
|
public KEY_TYPE FIRST_KEY() { synchronized(mutex) { return s.FIRST_KEY(); } }
|
||||||
|
@ -558,26 +558,20 @@ public class SETS
|
||||||
|
|
||||||
private static class SynchronizedSet KEY_GENERIC_TYPE extends SynchronizedCollection KEY_GENERIC_TYPE implements SET KEY_GENERIC_TYPE
|
private static class SynchronizedSet KEY_GENERIC_TYPE extends SynchronizedCollection KEY_GENERIC_TYPE implements SET KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
#if !TYPE_OBJECT
|
|
||||||
SET KEY_GENERIC_TYPE s;
|
SET KEY_GENERIC_TYPE s;
|
||||||
#endif
|
|
||||||
|
|
||||||
SynchronizedSet(SET KEY_GENERIC_TYPE c) {
|
SynchronizedSet(SET KEY_GENERIC_TYPE c) {
|
||||||
super(c);
|
super(c);
|
||||||
#if !TYPE_OBJECT
|
|
||||||
s = c;
|
s = c;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SynchronizedSet(SET KEY_GENERIC_TYPE c, Object mutex) {
|
SynchronizedSet(SET KEY_GENERIC_TYPE c, Object mutex) {
|
||||||
super(c, mutex);
|
super(c, mutex);
|
||||||
#if !TYPE_OBJECT
|
|
||||||
s = c;
|
s = c;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SET KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public SET KEY_GENERIC_TYPE copy() { synchronized(mutex) { return s.copy(); } }
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -368,31 +368,31 @@ public class MAPS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { return synchronize(map.descendingMap()); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { return MAPS.synchronize(map.descendingMap()); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { return SETS.unmodifiable(map.navigableKeySet()); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { return SETS.unmodifiable(map.navigableKeySet()); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { return SETS.unmodifiable(map.descendingKeySet()); }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { return SETS.unmodifiable(map.descendingKeySet()); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { return unmodifiable(map.firstEntry()); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { return MAPS.unmodifiable(map.firstEntry()); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry() { return unmodifiable(map.lastEntry()); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry() { return MAPS.unmodifiable(map.lastEntry()); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollFirstEntry() { throw new UnsupportedOperationException(); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollFirstEntry() { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry() { throw new UnsupportedOperationException(); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry() { throw new UnsupportedOperationException(); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { return unmodifiable(map.subMap(fromKey, fromInclusive, toKey, toInclusive)); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { return MAPS.unmodifiable(map.subMap(fromKey, fromInclusive, toKey, toInclusive)); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { return unmodifiable(map.headMap(toKey, inclusive)); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { return MAPS.unmodifiable(map.headMap(toKey, inclusive)); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { return unmodifiable(map.tailMap(fromKey, inclusive)); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { return MAPS.unmodifiable(map.tailMap(fromKey, inclusive)); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return unmodifiable(map.subMap(fromKey, toKey)); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return MAPS.unmodifiable(map.subMap(fromKey, toKey)); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return unmodifiable(map.headMap(toKey)); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return MAPS.unmodifiable(map.headMap(toKey)); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return unmodifiable(map.tailMap(fromKey)); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return MAPS.unmodifiable(map.tailMap(fromKey)); }
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultMaxValue(KEY_TYPE e) { throw new UnsupportedOperationException(); }
|
public void setDefaultMaxValue(KEY_TYPE e) { throw new UnsupportedOperationException(); }
|
||||||
|
@ -412,13 +412,13 @@ public class MAPS
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE ceilingKey(KEY_TYPE key) { return map.ceilingKey(key); }
|
public KEY_TYPE ceilingKey(KEY_TYPE key) { return map.ceilingKey(key); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(KEY_TYPE key) { return unmodifiable(map.lowerEntry(key)); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(KEY_TYPE key) { return MAPS.unmodifiable(map.lowerEntry(key)); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(KEY_TYPE key) { return unmodifiable(map.higherEntry(key)); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(KEY_TYPE key) { return MAPS.unmodifiable(map.higherEntry(key)); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(KEY_TYPE key) { return unmodifiable(map.floorEntry(key)); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(KEY_TYPE key) { return MAPS.unmodifiable(map.floorEntry(key)); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key) { return unmodifiable(map.ceilingEntry(key)); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key) { return MAPS.unmodifiable(map.ceilingEntry(key)); }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
|
||||||
}
|
}
|
||||||
|
@ -451,11 +451,11 @@ public class MAPS
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); }
|
||||||
@Override
|
@Override
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return unmodifiable(map.subMap(fromKey, toKey)); }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return MAPS.unmodifiable(map.subMap(fromKey, toKey)); }
|
||||||
@Override
|
@Override
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return unmodifiable(map.headMap(toKey)); }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return MAPS.unmodifiable(map.headMap(toKey)); }
|
||||||
@Override
|
@Override
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return unmodifiable(map.tailMap(fromKey)); }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return MAPS.unmodifiable(map.tailMap(fromKey)); }
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE FIRST_ENTRY_KEY() { return map.FIRST_ENTRY_KEY(); }
|
public KEY_TYPE FIRST_ENTRY_KEY() { return map.FIRST_ENTRY_KEY(); }
|
||||||
@Override
|
@Override
|
||||||
|
@ -548,7 +548,7 @@ public class MAPS
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public void forEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
s.forEach(T -> action.accept(unmodifiable(T)));
|
s.forEach(T -> action.accept(MAPS.unmodifiable(T)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -558,7 +558,7 @@ public class MAPS
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() { return iter.hasNext(); }
|
public boolean hasNext() { return iter.hasNext(); }
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE next() { return unmodifiable(iter.next()); }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE next() { return MAPS.unmodifiable(iter.next()); }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,7 +583,7 @@ public class MAPS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { synchronized(mutex) { return synchronize(map.descendingMap(), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { synchronized(mutex) { return MAPS.synchronize(map.descendingMap(), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { synchronized(mutex) { return SETS.synchronize(map.navigableKeySet(), mutex); } }
|
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { synchronized(mutex) { return SETS.synchronize(map.navigableKeySet(), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
|
@ -597,17 +597,17 @@ public class MAPS
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry() { synchronized(mutex) { return map.pollLastEntry(); } }
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry() { synchronized(mutex) { return map.pollLastEntry(); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { synchronized(mutex) { return synchronize(map.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { synchronized(mutex) { return MAPS.synchronize(map.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.headMap(toKey, inclusive), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { synchronized(mutex) { return MAPS.synchronize(map.headMap(toKey, inclusive), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.tailMap(fromKey, inclusive), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey, inclusive), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.subMap(fromKey, toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.headMap(toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE lowerKey(KEY_TYPE key) { synchronized(mutex) { return map.lowerKey(key); } }
|
public KEY_TYPE lowerKey(KEY_TYPE key) { synchronized(mutex) { return map.lowerKey(key); } }
|
||||||
@Override
|
@Override
|
||||||
|
@ -629,22 +629,22 @@ public class MAPS
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, boolean fromInclusive, CLASS_TYPE toKey, boolean toInclusive) { synchronized(mutex) { return synchronize(map.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, boolean fromInclusive, CLASS_TYPE toKey, boolean toInclusive) { synchronized(mutex) { return MAPS.synchronize(map.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.headMap(toKey, inclusive), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey, boolean inclusive) { synchronized(mutex) { return MAPS.synchronize(map.headMap(toKey, inclusive), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.tailMap(fromKey, inclusive), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey, inclusive), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.subMap(fromKey, toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.headMap(toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } }
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultMaxValue(KEY_TYPE e) { synchronized(mutex) { map.setDefaultMaxValue(e); } }
|
public void setDefaultMaxValue(KEY_TYPE e) { synchronized(mutex) { map.setDefaultMaxValue(e); } }
|
||||||
@Override
|
@Override
|
||||||
|
@ -713,11 +713,11 @@ public class MAPS
|
||||||
@Override
|
@Override
|
||||||
public COMPARATOR KEY_GENERIC_TYPE comparator() { synchronized(mutex) { return map.comparator(); } }
|
public COMPARATOR KEY_GENERIC_TYPE comparator() { synchronized(mutex) { return map.comparator(); } }
|
||||||
@Override
|
@Override
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.subMap(fromKey, toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.headMap(toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
public KEY_TYPE FIRST_ENTRY_KEY() { synchronized(mutex) { return map.FIRST_ENTRY_KEY(); } }
|
public KEY_TYPE FIRST_ENTRY_KEY() { synchronized(mutex) { return map.FIRST_ENTRY_KEY(); } }
|
||||||
@Override
|
@Override
|
||||||
|
@ -741,13 +741,13 @@ public class MAPS
|
||||||
public CLASS_TYPE lastKey() { synchronized(mutex) { return map.lastKey(); } }
|
public CLASS_TYPE lastKey() { synchronized(mutex) { return map.lastKey(); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.subMap(fromKey, toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return MAPS.synchronize(map.headMap(toKey), mutex); } }
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } }
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey), mutex); } }
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue