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;
|
||||||
|
@ -219,17 +432,19 @@ 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();
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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