diff --git a/Changelog.md b/Changelog.md index c2e2d92..058d4db 100644 --- a/Changelog.md +++ b/Changelog.md @@ -9,6 +9,7 @@ - Added: ArrayList.of(Class, size) that allows you to allocate a size right at the creation of the List without having to create a wrapper array. - Added: A ConcurrentHashMap implementation. - Fixed: containsValue in the HashMap wouldn't check the nullKey +- Removed: Deprecated functions from SortedMaps/Sets ### Version 0.5.3 - Added: OrderedMap/Set diff --git a/README.md b/README.md index b1252cd..480c43f 100644 --- a/README.md +++ b/README.md @@ -7,11 +7,12 @@ It is based on Java's Collection Library and FastUtil. But its focus is a different one. ## Main Features: -- ArrayLists / LinkedLists +- ArrayLists / LinkedLists / CopyOnWriteLists - HashSets/Maps (Linked & HashControl) - TreeSets/Maps (RB & AVL) - EnumMaps - Immutable Maps/Lists/Sets +- ConcurrentHashMaps - Priority Queues - Streams & Functional Queries - SplitIterators @@ -20,7 +21,7 @@ But its focus is a different one. - Unary/Functions - Suppliers - Bi/Consumers - +- AsyncBuilders ## Current Level of Stability Since this is a relatively new Library, stability was not perfect and some areas are not perfect yet. @@ -95,13 +96,14 @@ repositories { } } dependencies { - compile 'de.speiger:Primitive-Collections:0.5.3' + compile 'de.speiger:Primitive-Collections:0.6.0' } ``` Direct: | Version | Jar | Sources | Java Doc | |--------- |------------------------------------------------------------------------------------------------------------------------------ |-------------------------------------------------------------------------------------------------------------------------------------- |-------------------------------------------------------------------------------------------------------------------------------------- | +| 0.6.0 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.6.0/Primitive-Collections-0.6.0.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.6.0/Primitive-Collections-0.6.0-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.6.0/Primitive-Collections-0.6.0-javadoc.jar) | | 0.5.3 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.3/Primitive-Collections-0.5.3-javadoc.jar) | | 0.5.2 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.2/Primitive-Collections-0.5.2-javadoc.jar) | | 0.5.1 | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.1/Primitive-Collections-0.5.1.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.1/Primitive-Collections-0.5.1-sources.jar) | [Download](https://maven.speiger.com/repository/main/de/speiger/Primitive-Collections/0.5.1/Primitive-Collections-0.5.1-javadoc.jar) | diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template index e214de0..3dbb63d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template @@ -1,7 +1,6 @@ package speiger.src.collections.PACKAGE.maps.impl.customHash; import java.util.Arrays; -import java.util.Comparator; import java.util.Map; import java.util.NoSuchElementException; import java.util.function.Consumer; @@ -10,7 +9,6 @@ import java.util.Objects; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif @@ -22,9 +20,8 @@ import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; -import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.utils.STRATEGY; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; @@ -60,7 +57,6 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; import speiger.src.collections.objects.lists.ObjectListIterator; import speiger.src.collections.objects.sets.AbstractObjectSet; -import speiger.src.collections.objects.sets.ObjectSortedSet; import speiger.src.collections.objects.sets.ObjectSet; #endif import speiger.src.collections.utils.HashUtil; @@ -72,7 +68,7 @@ import speiger.src.collections.utils.HashUtil; * @Type(T) * @ValueType(V) */ -public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE +public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE { /** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */ protected transient long[] links; @@ -364,20 +360,6 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M return map; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { - return null; - } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); } - @Override public KEY_TYPE FIRST_ENTRY_KEY() { if(size == 0) throw new NoSuchElementException(); @@ -621,7 +603,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M values = newValues; } - private class MapEntrySet extends AbstractObjectSet implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE { + private class MapEntrySet extends AbstractObjectSet implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE { @Override public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } @Override @@ -861,20 +843,9 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M public void clear() { LINKED_CUSTOM_HASH_MAP.this.clear(); } - - @Override - public Comparator comparator() { - return null; - } - @Override - public ObjectSortedSet subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); } } - private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { + private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { #if TYPE_OBJECT @Override @Deprecated @@ -1093,18 +1064,6 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } return result; } - - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } } private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE { diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template index 8245edd..5fd99a1 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template @@ -1,7 +1,6 @@ package speiger.src.collections.PACKAGE.maps.impl.hash; import java.util.Arrays; -import java.util.Comparator; import java.util.Map; import java.util.NoSuchElementException; import java.util.function.Consumer; @@ -10,7 +9,6 @@ import java.util.Objects; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif @@ -21,10 +19,9 @@ import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; -import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; @@ -59,7 +56,6 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; import speiger.src.collections.objects.lists.ObjectListIterator; import speiger.src.collections.objects.sets.AbstractObjectSet; -import speiger.src.collections.objects.sets.ObjectSortedSet; import speiger.src.collections.objects.sets.ObjectSet; #endif import speiger.src.collections.utils.HashUtil; @@ -71,7 +67,7 @@ import speiger.src.collections.utils.HashUtil; * @Type(T) * @ValueType(V) */ -public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE +public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE { /** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */ protected transient long[] links; @@ -368,20 +364,6 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G return map; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { - return null; - } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); } - @Override public KEY_TYPE FIRST_ENTRY_KEY() { if(size == 0) throw new NoSuchElementException(); @@ -625,7 +607,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G values = newValues; } - private class MapEntrySet extends AbstractObjectSet implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE { + private class MapEntrySet extends AbstractObjectSet implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE { @Override public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } @Override @@ -862,20 +844,9 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G public void clear() { LINKED_HASH_MAP.this.clear(); } - - @Override - public Comparator comparator() { - return null; - } - @Override - public ObjectSortedSet subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); } } - private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { + private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { #if TYPE_OBJECT @Override @Deprecated @@ -1092,18 +1063,6 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } return result; } - - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } } private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE { diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template index 921185b..68991fa 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template @@ -1,7 +1,6 @@ package speiger.src.collections.PACKAGE.maps.impl.immutable; import java.util.Arrays; -import java.util.Comparator; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; @@ -11,7 +10,6 @@ import java.util.function.BiFunction; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif #if !TYPE_OBJECT && !VALUE_BOOLEAN @@ -24,11 +22,10 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; #endif import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; -import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.utils.maps.MAPS; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.utils.ARRAYS; @@ -71,7 +68,6 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera #endif import speiger.src.collections.objects.lists.ObjectListIterator; -import speiger.src.collections.objects.sets.ObjectSortedSet; #endif import speiger.src.collections.objects.sets.AbstractObjectSet; import speiger.src.collections.objects.sets.ObjectSet; @@ -85,7 +81,7 @@ import speiger.src.collections.utils.SanityChecks; * @Type(T) * @ValueType(V) */ -public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE +public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE { /** The Backing keys array */ protected transient KEY_TYPE[] keys; @@ -465,15 +461,6 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ return map; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); } - @Override public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) { int index = firstIndex; @@ -597,7 +584,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } } - private class MapEntrySet extends AbstractObjectSet implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE { + private class MapEntrySet extends AbstractObjectSet implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE { @Override public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } @Override @@ -810,20 +797,9 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ @Override public void clear() { throw new UnsupportedOperationException(); } - - @Override - public Comparator comparator() { - return null; - } - @Override - public ObjectSortedSet subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); } } - private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { + private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { #if TYPE_OBJECT @Override @Deprecated @@ -1024,18 +1000,6 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } return result; } - - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } } private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE { diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template index c015c6f..fe991ad 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template @@ -1,7 +1,6 @@ package speiger.src.collections.PACKAGE.maps.impl.misc; import java.util.Arrays; -import java.util.Comparator; import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; @@ -10,7 +9,6 @@ import java.util.function.BiFunction; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif @@ -27,9 +25,8 @@ import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; -import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; @@ -69,7 +66,7 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; import speiger.src.collections.objects.lists.ObjectListIterator; import speiger.src.collections.objects.sets.AbstractObjectSet; -import speiger.src.collections.objects.sets.ObjectSortedSet; +import speiger.src.collections.objects.sets.ObjectOrderedSet; #endif import speiger.src.collections.utils.HashUtil; @@ -84,7 +81,7 @@ import speiger.src.collections.utils.HashUtil; * @Type(T) * @ValueType(V) */ -public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE +public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE { /** The Backing keys array */ protected transient KEY_TYPE[] keys; @@ -97,7 +94,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN /** Values cache */ protected VALUE_COLLECTION VALUE_GENERIC_TYPE valuesC; /** EntrySet cache */ - protected FastSortedSet KEY_VALUE_GENERIC_TYPE entrySet; + protected FastOrderedSet KEY_VALUE_GENERIC_TYPE entrySet; /** * Default Constructor @@ -452,7 +449,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public ObjectSortedSet ENTRY_SET() { + public ObjectOrderedSet ENTRY_SET() { if(entrySet == null) entrySet = new MapEntrySet(); return entrySet; } @@ -598,38 +595,6 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN return map; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { - return null; - } - - /** - * Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions. - * It is a Unsorted Sorted Map. Thats why the SubMap implementation will be disabled until a better solution is found. - * To give a simple reason: LinkedHashMaps are also not SortedSets even so they could be. - * @throws UnsupportedOperationException because it is not supported - */ - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - - /** - * Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions. - * It is a Unsorted Sorted Map. Thats why the SubMap implementation will be disabled until a better solution is found. - * To give a simple reason: LinkedHashMaps are also not SortedSets even so they could be. - * @throws UnsupportedOperationException because it is not supported - */ - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { throw new UnsupportedOperationException(); } - - /** - * Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions. - * It is a Unsorted Sorted Map. Thats why the SubMap implementation will be disabled until a better solution is found. - * To give a simple reason: LinkedHashMaps are also not SortedSets even so they could be. - * @throws UnsupportedOperationException because it is not supported - */ - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { throw new UnsupportedOperationException(); } - protected void moveIndexToFirst(int index) { if(index == 0) return; KEY_TYPE key = keys[index]; @@ -738,1073 +703,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN return -1; } -// private class SubMap extends ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE { -// int offset; -// int length; -// -// SET KEY_GENERIC_TYPE keySet; -// VALUE_COLLECTION VALUE_GENERIC_TYPE valuesC; -// FastSortedSet KEY_VALUE_GENERIC_TYPE entrySet; -// -// public SubMap(int offset, int length) { -// this.offset = offset; -// this.length = length; -// } -// -// int end() { return offset+length; } -// -// @Override -// public VALUE_TYPE put(KEY_TYPE key, VALUE_TYPE value) { -// int index = findIndex(key); -// if(index < 0) { -// insertIndex(end(), key, value); -// length++; -// return getDefaultReturnValue(); -// } -// VALUE_TYPE oldValue = values[index]; -// values[index] = value; -// return oldValue; -// } -// -// @Override -// public VALUE_TYPE putIfAbsent(KEY_TYPE key, VALUE_TYPE value) { -// int index = findIndex(key); -// if(index >= 0) { -// insertIndex(end(), key, value); -// length++; -// } -// return getDefaultReturnValue(); -// } -// -//#if VALUE_PRIMITIVES -// @Override -// public VALUE_TYPE addTo(KEY_TYPE key, VALUE_TYPE value) { -// int index = findIndex(key); -// if(index < 0) { -// insertIndex(end(), key, value); -// length++; -// return getDefaultReturnValue(); -// } -// VALUE_TYPE oldValue = values[index]; -// values[index] += value; -// return oldValue; -// } -// -//#endif -// @Override -// public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { -// int index = findIndex(key); -// if(index < 0) { -// insertIndex(offset, key, value); -// length++; -// return getDefaultReturnValue(); -// } -// VALUE_TYPE lastValue = values[index]; -// values[index] = value; -// moveIndexToFirst(index); -// return lastValue; -// } -// -// @Override -// public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { -// int index = findIndex(key); -// if(index < 0) { -// insertIndex(end(), key, value); -// length++; -// return getDefaultReturnValue(); -// } -// VALUE_TYPE lastValue = values[index]; -// values[index] = value; -// moveIndexToLast(index); -// return lastValue; -// } -// -// @Override -// public boolean moveToFirst(KEY_TYPE key) { -// int index = findIndex(key); -// if(index > 0) { -// moveIndexToFirst(index); -// return true; -// } -// return false; -// } -// -// @Override -// public boolean moveToLast(KEY_TYPE key) { -// int index = findIndex(key); -// if(index < size()-1) { -// moveIndexToLast(index); -// return true; -// } -// return false; -// } -// -//#if !TYPE_OBJECT -// @Override -// public boolean containsKey(KEY_TYPE key) { -// return findIndex(key) >= 0; -// } -// -//#endif -//#if !VALUE_OBJECT -// @Override -// public boolean containsValue(VALUE_TYPE value) { -// return findValue(value) >= 0; -// } -// -//#endif -// @Override -// public boolean containsKey(Object key) { -// return findIndex(key) >= 0; -// } -// -// @Override -// public boolean containsValue(Object value) { -// return findValue(value) >= 0; -// } -// -// @Override -// public VALUE_TYPE GET_VALUE(KEY_TYPE key) { -// int index = findIndex(key); -// return index < 0 ? getDefaultReturnValue() : values[index]; -// } -// -//#if TYPE_OBJECT && VALUE_OBJECT -// @Override -// public VALUE_TYPE getOrDefault(Object key, VALUE_TYPE defaultValue) { -// int index = findIndex(key); -// return index < 0 ? defaultValue : values[index]; -// } -// -//#else -// @Override -// public VALUE_TYPE getOrDefault(KEY_TYPE key, VALUE_TYPE defaultValue) { -// int index = findIndex(key); -// return index < 0 ? defaultValue : values[index]; -// } -// -//#endif -// @Override -// public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { -// int index = findIndex(key); -// if(index >= 0) { -// VALUE_TYPE value = values[index]; -// moveIndexToFirst(index); -// return value; -// } -// return getDefaultReturnValue(); -// } -// -// @Override -// public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { -// int index = findIndex(key); -// if(index >= 0) { -// VALUE_TYPE value = values[index]; -// moveIndexToLast(index); -// return value; -// } -// return getDefaultReturnValue(); -// } -// -// @Override -// public KEY_TYPE FIRST_ENTRY_KEY() { -// if(length <= 0) throw new NoSuchElementException(); -// return keys[offset]; -// } -// -// @Override -// public KEY_TYPE LAST_ENTRY_KEY() { -// if(length <= 0) throw new NoSuchElementException(); -// return keys[end()-1]; -// } -// -// @Override -// public VALUE_TYPE FIRST_ENTRY_VALUE() { -// if(length <= 0) throw new NoSuchElementException(); -// return values[end()-1]; -// } -// -// @Override -// public VALUE_TYPE LAST_ENTRY_VALUE() { -// if(length <= 0) throw new NoSuchElementException(); -// return values[offset]; -// } -// -// @Override -// public KEY_TYPE POLL_FIRST_ENTRY_KEY() { -// if(length == 0) throw new NoSuchElementException(); -// KEY_TYPE result = keys[offset]; -// removeIndex(offset); -// length--; -// return result; -// } -// -// @Override -// public KEY_TYPE POLL_LAST_ENTRY_KEY() { -// if(length == 0) throw new NoSuchElementException(); -// KEY_TYPE result = keys[end()-1]; -// removeIndex(end()-1); -// length--; -// return result; -// } -// -// @Override -// public VALUE_TYPE REMOVE_VALUE(KEY_TYPE key) { -// int index = findIndex(key); -// if(index < 0) return getDefaultReturnValue(); -// VALUE_TYPE value = values[index]; -// removeIndex(index); -// length--; -// return value; -// } -// -// @Override -// public VALUE_TYPE REMOVE_VALUEOrDefault(KEY_TYPE key, VALUE_TYPE defaultValue) { -// int index = findIndex(key); -// if(index < 0) return defaultValue; -// VALUE_TYPE value = values[index]; -// removeIndex(index); -// length--; -// return value; -// } -// -//#if !TYPE_OBJECT || !VALUE_OBJECT -// @Override -// public boolean remove(KEY_TYPE key, VALUE_TYPE value) { -// int index = findIndex(key, value); -// if(index < 0) return false; -// removeIndex(index); -// length--; -// return true; -// } -// -//#endif -// @Override -// public CLASS_VALUE_TYPE remove(Object key) { -// int index = findIndex(key); -// if(index < 0) return VALUE_TO_OBJ(getDefaultReturnValue()); -// VALUE_TYPE value = values[index]; -// removeIndex(index); -// length--; -// return VALUE_TO_OBJ(value); -// } -// -// @Override -// public boolean remove(Object key, Object value) { -// int index = findIndex(key, value); -// if(index < 0) return false; -// removeIndex(index); -// length--; -// return true; -// } -// -// @Override -// public int size() { -// return length; -// } -// -// @Override -// public void clear() { -// removeRange(offset, offset+length); -// length = 0; -// } -// -// @Override -// public SET KEY_GENERIC_TYPE keySet() { -// if(keySet == null) keySet = new SubKeySet(); -// return keySet; -// } -// -// @Override -// public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { -// if(valuesC == null) valuesC = new SubValues(); -// return valuesC; -// } -// -// @Override -// public ObjectSet ENTRY_SET() { -// if(entrySet == null) entrySet = new SubMapEntrySet(); -// return entrySet; -// } -// -// @Override -// public SubMap copy() { -// throw new UnsupportedOperationException(); -// } -// -// @Override -// public COMPARATOR KEY_GENERIC_TYPE comparator() { -// return null; -// } -// -// @Override -// public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { -// int fromIndex = findIndex(fromKey); -// int toIndex = findIndex(toKey); -// if(fromIndex == -1 || toIndex == -1) throw new NoSuchElementException(); -// return new SubMap(fromIndex, toIndex - fromIndex + 1); -// } -// -// @Override -// public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { -// int toIndex = findIndex(toKey); -// if(toIndex == -1) throw new NoSuchElementException(); -// return new SubMap(offset, toIndex + 1); -// } -// -// @Override -// public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { -// int fromIndex = findIndex(fromKey); -// if(fromIndex == -1) throw new NoSuchElementException(); -// return new SubMap(fromIndex, size - fromIndex); -// } -// -// protected void moveIndexToFirst(int index) { -// if(index == 0) return; -// KEY_TYPE key = keys[index]; -// VALUE_TYPE value = values[index]; -// System.arraycopy(keys, offset, keys, offset+1, index); -// System.arraycopy(values, offset, values, offset+1, index); -// keys[offset] = key; -// values[offset] = value; -// } -// -// protected void moveIndexToLast(int index) { -// if(index == length-1) return; -// KEY_TYPE key = keys[index]; -// VALUE_TYPE value = values[index]; -// System.arraycopy(keys, index+1, keys, index, end()-index-1); -// System.arraycopy(values, index+1, values, index, end()-index-1); -// keys[end()-1] = key; -// values[end()-1] = value; -// } -// -//#if !TYPE_OBJECT || !VALUE_OBJECT -// protected int findIndex(KEY_TYPE key, VALUE_TYPE value) { -// for(int i = length-1;i>=0;i--) -// if(KEY_EQUALS(keys[offset+i], key) && VALUE_EQUALS(values[offset+i], value)) return i; -// return -1; -// } -// -//#endif -//#if !TYPE_OBJECT -// protected int findIndex(KEY_TYPE key) { -// for(int i = length-1;i>=0;i--) -// if(KEY_EQUALS(keys[offset+i], key)) return i+offset; -// return -1; -// } -// -//#endif -//#if !VALUE_OBJECT -// protected int findValue(VALUE_TYPE value) { -// for(int i = length-1;i>=0;i--) -// if(VALUE_EQUALS(values[offset+i], value)) return i+offset; -// return -1; -// } -// -//#endif -// protected int findIndex(Object key, Object value) { -// for(int i = length-1;i>=0;i--) -// if(EQUALS_KEY_TYPE(keys[offset+i], key) && EQUALS_VALUE_TYPE(values[offset+i], value)) return i+offset; -// return -1; -// } -// -// protected int findIndex(Object key) { -// for(int i = length-1;i>=0;i--) -// if(EQUALS_KEY_TYPE(keys[offset+i], key)) return i+offset; -// return -1; -// } -// -// protected int findValue(Object value) { -// for(int i = length-1;i>=0;i--) -// if(EQUALS_VALUE_TYPE(values[offset+i], value)) return i+offset; -// return -1; -// } -// -// private class SubMapEntrySet extends AbstractObjectSet implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE { -// @Override -// public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } -// @Override -// public boolean addAndMoveToLast(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } -// -// @Override -// public boolean moveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { -// return SubMap.this.moveToFirst(o.ENTRY_KEY()); -// } -// -// @Override -// public boolean moveToLast(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { -// return SubMap.this.moveToLast(o.ENTRY_KEY()); -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE first() { -// return new BasicEntryKV_BRACES(FIRST_ENTRY_KEY(), FIRST_ENTRY_VALUE()); -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE last() { -// return new BasicEntryKV_BRACES(LAST_ENTRY_KEY(), LAST_ENTRY_VALUE()); -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE pollFirst() { -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(FIRST_ENTRY_KEY(), FIRST_ENTRY_VALUE()); -// POLL_FIRST_ENTRY_KEY(); -// return entry; -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLast() { -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(LAST_ENTRY_KEY(), LAST_ENTRY_VALUE()); -// POLL_LAST_ENTRY_KEY(); -// return entry; -// } -// -// @Override -// public ObjectBidirectionalIterator iterator() { -// return new SubEntryIterator(); -// } -// -// @Override -// public ObjectBidirectionalIterator iterator(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { -// return new SubEntryIterator(fromElement.ENTRY_KEY()); -// } -// -// @Override -// public ObjectBidirectionalIterator fastIterator() { -// return new SubFastEntryIterator(); -// } -// -// @Override -// public ObjectBidirectionalIterator fastIterator(KEY_TYPE fromElement) { -// return new SubFastEntryIterator(fromElement); -// } -// -// @Override -// public SubMapEntrySet copy() { throw new UnsupportedOperationException(); } -// -// @Override -// public void forEach(Consumer action) { -// Objects.requireNonNull(action); -// for(int i = 0;i action) { -// Objects.requireNonNull(action); -// if(size() <= 0) return; -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); -// for(int i = 0;i void forEach(E input, ObjectObjectConsumer action) { -// Objects.requireNonNull(action); -// for(int i = 0;i filter) { -// Objects.requireNonNull(filter); -// if(size() <= 0) return false; -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); -// for(int i = 0;i filter) { -// Objects.requireNonNull(filter); -// if(size() <= 0) return true; -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); -// for(int i = 0;i filter) { -// Objects.requireNonNull(filter); -// if(size() <= 0) return true; -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); -// for(int i = 0;i E reduce(E identity, BiFunction operator) { -// Objects.requireNonNull(operator); -// E state = identity; -// for(int i = 0;i operator) { -// Objects.requireNonNull(operator); -// MAP.Entry KEY_VALUE_GENERIC_TYPE state = null; -// boolean empty = true; -// for(int i = 0;i filter) { -// Objects.requireNonNull(filter); -// if(size() <= 0) return null; -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); -// for(int i = 0;i filter) { -// Objects.requireNonNull(filter); -// if(size() <= 0) return 0; -// int result = 0; -// BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); -// for(int i = 0;i= 0; -// } -// else { -// Map.Entry entry = (Map.Entry)o; -// return ARRAY_MAP.this.findIndex(entry.getKey(), entry.getValue()) >= 0; -// } -// } -// return false; -// } -// -// @Override -// @Deprecated -// public boolean remove(Object o) { -// if(o instanceof Map.Entry) { -// if(o instanceof MAP.Entry) { -// MAP.Entry KEY_VALUE_GENERIC_TYPE entry = (MAP.Entry KEY_VALUE_GENERIC_TYPE)o; -// return SubMap.this.remove(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); -// } -// Map.Entry entry = (Map.Entry)o; -// return SubMap.this.remove(entry.getKey(), entry.getValue()); -// } -// return false; -// } -// -// @Override -// public int size() { -// return SubMap.this.size(); -// } -// -// @Override -// public void clear() { -// SubMap.this.clear(); -// } -// -// @Override -// public Comparator comparator() { -// return null; -// } -// @Override -// public ObjectSortedSet subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } -// @Override -// public ObjectSortedSet headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } -// @Override -// public ObjectSortedSet tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); } -// } -// -// private class SubKeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { -//#if TYPE_OBJECT -// @Override -// public boolean contains(Object e) { return containsKey(e); } -// -// @Override -// public boolean remove(Object o) { -// int oldSize = length; -// SubMap.this.remove(o); -// return length != oldSize; -// } -// -//#else -// @Override -// public boolean contains(KEY_TYPE e) { return containsKey(e); } -// -// @Override -// public boolean remove(KEY_TYPE o) { -// int oldSize = length; -// SubMap.this.remove(o); -// return length != oldSize; -// } -// -//#endif -// @Override -// public boolean add(KEY_TYPE o) { throw new UnsupportedOperationException(); } -// @Override -// public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } -// @Override -// public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } -// @Override -// public boolean moveToFirst(KEY_TYPE o) { return SubMap.this.moveToFirst(o); } -// @Override -// public boolean moveToLast(KEY_TYPE o) { return SubMap.this.moveToLast(o); } -// @Override -// public LIST_ITERATOR KEY_GENERIC_TYPE iterator() { return new SubKeyIterator(); } -// @Override -// public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { return new SubKeyIterator(fromElement); } -// @Override -// public int size() { return SubMap.this.size(); } -// @Override -// public void clear() { SubMap.this.clear(); } -// @Override -// public KEY_TYPE FIRST_KEY() { return FIRST_ENTRY_KEY(); } -// @Override -// public KEY_TYPE POLL_FIRST_KEY() { return POLL_FIRST_ENTRY_KEY(); } -// @Override -// public KEY_TYPE LAST_KEY() { return LAST_ENTRY_KEY(); } -// @Override -// public KEY_TYPE POLL_LAST_KEY() { return POLL_LAST_ENTRY_KEY(); } -// -// @Override -// public SubKeySet copy() { throw new UnsupportedOperationException(); } -// -// @Override -// public void forEach(CONSUMER KEY_SUPER_GENERIC_TYPE action) { -// Objects.requireNonNull(action); -// for(int i = 0;i void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { -// Objects.requireNonNull(action); -// if(size() <= 0) return; -// for(int i = 0;i KEY_SPECIAL_TYPE reduce(KEY_SPECIAL_TYPE identity, BiFunction operator) { -// Objects.requireNonNull(operator); -// KEY_SPECIAL_TYPE state = identity; -// for(int i = 0;i void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { -// Objects.requireNonNull(action); -// for(int i = 0;i VALUE_SPECIAL_TYPE reduce(VALUE_SPECIAL_TYPE identity, BiFunction operator) { -// Objects.requireNonNull(operator); -// VALUE_SPECIAL_TYPE state = identity; -// for(int i = 0;i { -// MapEntry entry = new MapEntry(); -// -// public SubFastEntryIterator() {} -// public SubFastEntryIterator(KEY_TYPE from) { -// index = findIndex(from); -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE next() { -// entry.index = nextEntry(); -// return entry; -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE previous() { -// entry.index = previousEntry(); -// return entry; -// } -// -// @Override -// public void set(MAP.Entry KEY_VALUE_GENERIC_TYPE e) { throw new UnsupportedOperationException(); } -// @Override -// public void add(MAP.Entry KEY_VALUE_GENERIC_TYPE e) { throw new UnsupportedOperationException(); } -// } -// -// private class SubEntryIterator extends SubMapIterator implements ObjectListIterator { -// MapEntry entry = null; -// -// public SubEntryIterator() {} -// public SubEntryIterator(KEY_TYPE from) { -// index = findIndex(from); -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE next() { -// return entry = new MapEntry(nextEntry()); -// } -// -// @Override -// public MAP.Entry KEY_VALUE_GENERIC_TYPE previous() { -// return entry = new MapEntry(previousEntry()); -// } -// -// @Override -// public void remove() { -// super.remove(); -// entry.index = -1; -// } -// -// @Override -// public void set(MAP.Entry KEY_VALUE_GENERIC_TYPE e) { throw new UnsupportedOperationException(); } -// @Override -// public void add(MAP.Entry KEY_VALUE_GENERIC_TYPE e) { throw new UnsupportedOperationException(); } -// } -// -// private class SubKeyIterator extends SubMapIterator implements LIST_ITERATOR KEY_GENERIC_TYPE { -// public SubKeyIterator() {} -// public SubKeyIterator(KEY_TYPE element) { -// index = findIndex(element); -// } -// @Override -// public KEY_TYPE PREVIOUS() { -// return keys[previousEntry()]; -// } -// -// @Override -// public KEY_TYPE NEXT() { -// return keys[nextEntry()]; -// } -// -// @Override -// public void set(KEY_TYPE e) { throw new UnsupportedOperationException(); } -// -// @Override -// public void add(KEY_TYPE e) { throw new UnsupportedOperationException(); } -// } -// -// private class SubValueIterator extends SubMapIterator implements VALUE_LIST_ITERATOR VALUE_GENERIC_TYPE { -// @Override -// public VALUE_TYPE VALUE_PREVIOUS() { -// return values[previousEntry()]; -// } -// -// @Override -// public VALUE_TYPE VALUE_NEXT() { -// return values[nextEntry()]; -// } -// -// @Override -// public void set(VALUE_TYPE e) { throw new UnsupportedOperationException(); } -// -// @Override -// public void add(VALUE_TYPE e) { throw new UnsupportedOperationException(); } -// } -// -// private class SubMapIterator { -// int index; -// int lastReturned = -1; -// -// public boolean hasNext() { -// return index < length; -// } -// -// public boolean hasPrevious() { -// return index > 0; -// } -// -// public int nextIndex() { -// return index; -// } -// -// public int previousIndex() { -// return index-1; -// } -// -// public void remove() { -// if(lastReturned == -1) -// throw new IllegalStateException(); -// removeIndex(lastReturned); -// if(lastReturned < index) -// index--; -// lastReturned = -1; -// } -// -// public int previousEntry() { -// if(!hasPrevious()) throw new NoSuchElementException(); -// int returnIndex = offset+index; -// lastReturned = index--; -// return returnIndex; -// } -// -// public int nextEntry() { -// if(!hasNext()) throw new NoSuchElementException(); -// int returnIndex = offset+index; -// lastReturned = index++; -// return returnIndex; -// } -// -// public int skip(int amount) { -// if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed"); -// int steps = Math.min(amount, (size() - 1) - index); -// index += steps; -// return steps; -// } -// -// public int back(int amount) { -// if(amount < 0) throw new IllegalStateException("Negative Numbers are not allowed"); -// int steps = Math.min(amount, index); -// index -= steps; -// return steps; -// } -// } -// } - - private class MapEntrySet extends AbstractObjectSet implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE { + private class MapEntrySet extends AbstractObjectSet implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE { @Override public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } @Override @@ -2021,20 +920,9 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN public void clear() { ARRAY_MAP.this.clear(); } - - @Override - public Comparator comparator() { - return null; - } - @Override - public ObjectSortedSet subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); } } - private class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { + private class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { #if TYPE_OBJECT @Override public boolean contains(Object e) { return containsKey(e); } @@ -2186,15 +1074,6 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } return result; } - - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } } private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE { diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/LinkedEnumMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/LinkedEnumMap.template index c9b796d..f95147c 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/LinkedEnumMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/LinkedEnumMap.template @@ -1,6 +1,5 @@ package speiger.src.collections.PACKAGE.maps.impl.misc; -import java.util.Comparator; import java.util.Map; import java.util.NoSuchElementException; import java.util.function.Consumer; @@ -10,16 +9,14 @@ import java.util.Objects; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; -import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; -import speiger.src.collections.PACKAGE.sets.SORTED_SET; +import speiger.src.collections.PACKAGE.sets.ORDERED_SET; import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; @@ -32,7 +29,6 @@ import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR; import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; import speiger.src.collections.objects.lists.ObjectListIterator; import speiger.src.collections.objects.sets.AbstractObjectSet; -import speiger.src.collections.objects.sets.ObjectSortedSet; import speiger.src.collections.objects.sets.ObjectSet; #endif @@ -43,7 +39,7 @@ import speiger.src.collections.objects.sets.ObjectSet; * @Type(T) * @ValueType(V) */ -public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VALUE_GENERIC_TYPE implements SORTED_MAP KEY_VALUE_GENERIC_TYPE, ORDERED_MAP KEY_VALUE_GENERIC_TYPE +public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VALUE_GENERIC_TYPE implements ORDERED_MAP KEY_VALUE_GENERIC_TYPE { /** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */ protected long[] links; @@ -270,20 +266,6 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA return map; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { - return null; - } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(T fromKey, T toKey) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(T toKey) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(T fromKey) { throw new UnsupportedOperationException(); } - @Override public T FIRST_ENTRY_KEY() { if(size == 0) throw new NoSuchElementException(); @@ -434,7 +416,7 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA } } - private class MapEntrySet extends AbstractObjectSet implements SORTED_MAP.FastSortedSet KEY_VALUE_GENERIC_TYPE { + private class MapEntrySet extends AbstractObjectSet implements ORDERED_MAP.FastOrderedSet KEY_VALUE_GENERIC_TYPE { @Override public boolean addAndMoveToFirst(MAP.Entry KEY_VALUE_GENERIC_TYPE o) { throw new UnsupportedOperationException(); } @Override @@ -559,20 +541,9 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA public void clear() { LINKED_ENUM_MAP.this.clear(); } - - @Override - public Comparator comparator() { - return null; - } - @Override - public ObjectSortedSet subSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement, MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet headSet(MAP.Entry KEY_VALUE_GENERIC_TYPE toElement) { throw new UnsupportedOperationException(); } - @Override - public ObjectSortedSet tailSet(MAP.Entry KEY_VALUE_GENERIC_TYPE fromElement) { throw new UnsupportedOperationException(); } } - private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { + private final class KeySet extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { #if TYPE_OBJECT @Override @Deprecated @@ -685,17 +656,6 @@ public class LINKED_ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ENUM_MAP KEY_VA } #endif - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(T fromElement, T toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(T toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(T fromElement) { throw new UnsupportedOperationException(); } } private class Values extends VALUE_ABSTRACT_COLLECTION VALUE_GENERIC_TYPE { diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template index 92205f5..4b27525 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template @@ -363,19 +363,6 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } #endif - @Override - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; } @@ -1067,14 +1054,6 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ #endif @Override public boolean add(KEY_TYPE e) { throw new UnsupportedOperationException(); } - @Override - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } @Override public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { @@ -1543,18 +1522,6 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ protected Node KEY_VALUE_GENERIC_TYPE absHighFence() { return (toEnd ? null : (hiInclusive ? map.findHigherNode(hi) : map.findCeilingNode(hi))); } protected Node KEY_VALUE_GENERIC_TYPE absLowFence() { return (fromStart ? null : (loInclusive ? map.findLowerNode(lo) : map.findFloorNode(lo))); } - @Override - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template index 33b1ac8..2eb7d9a 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template @@ -366,19 +366,6 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } #endif - @Override - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return comparator; } @@ -1122,18 +1109,9 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G return oldSize != map.size(); } -#endif +#endif @Override public boolean add(KEY_TYPE e) { throw new UnsupportedOperationException(); } - @Override - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { if(map instanceof RB_TREE_MAP) return ((RB_TREE_MAP KEY_VALUE_GENERIC_TYPE)map).keyIterator(fromElement); @@ -1601,18 +1579,6 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G protected Node KEY_VALUE_GENERIC_TYPE absHighFence() { return (toEnd ? null : (hiInclusive ? map.findHigherNode(hi) : map.findCeilingNode(hi))); } protected Node KEY_VALUE_GENERIC_TYPE absLowFence() { return (fromStart ? null : (loInclusive ? map.findLowerNode(lo) : map.findFloorNode(lo))); } - @Override - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/OrderedMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/OrderedMap.template index dcdfc86..e3a1964 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/OrderedMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/OrderedMap.template @@ -1,6 +1,8 @@ package speiger.src.collections.PACKAGE.maps.interfaces; import speiger.src.collections.PACKAGE.utils.maps.MAPS; +import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; +import speiger.src.collections.objects.sets.ObjectOrderedSet; /** * A Special Map Interface giving Access to some really usefull functions * The Idea behind this interface is to allow access to functions that give control to the Order of elements. @@ -98,6 +100,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI * @return a new SortedMap that is synchronized * @see MAPS#synchronize */ + @Override public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize() { return MAPS.synchronize(this); } /** @@ -106,6 +109,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI * @return a new SortedMap Wrapper that is synchronized * @see MAPS#synchronize */ + @Override public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize(Object mutex) { return MAPS.synchronize(this, mutex); } /** @@ -113,5 +117,22 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI * @return a new SortedMap Wrapper that is unmodifiable * @see MAPS#unmodifiable */ + @Override public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); } + + /** + * Fast Ordered Entry Set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value + * @Type(T) + * @ValueType(V) + */ + interface FastOrderedSet KEY_VALUE_GENERIC_TYPE extends MAP.FastEntrySet KEY_VALUE_GENERIC_TYPE, ObjectOrderedSet { + @Override + public ObjectBidirectionalIterator fastIterator(); + /** + * Fast iterator that recycles the given Entry object to improve speed and reduce object allocation + * @param fromElement that is going to be started from. + * @return a improved iterator that starts from the desired element + */ + public ObjectBidirectionalIterator fastIterator(KEY_TYPE fromElement); + } } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template index 5169d74..42296d6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template @@ -22,71 +22,8 @@ import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; * @note ORDERED_MAP is only extended until 0.6.0 for Compat reasons. * The supported classes already implement ORDERED_MAP directly and will remove SORTED_MAP implementations in favor of ORDERED_MAP instead */ -public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap, ORDERED_MAP KEY_VALUE_GENERIC_TYPE +public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap, MAP KEY_VALUE_GENERIC_TYPE { - /** - * A customized put method that allows you to insert into the first index. - * @param key the key that should be inserted - * @param value the value that should be inserted - * @return the previous present or default return value - * @see java.util.Map#put(Object, Object) - * @note some implementations do not support this method - * @deprecated use ORDERED_MAP#putAndMoveToFirst instead (removed in 0.6.0) - */ - @Deprecated - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value); - /** - * A customized put method that allows you to insert into the last index. (This may be nessesary depending on the implementation) - * @param key the key that should be inserted - * @param value the value that should be inserted - * @return the previous present or default return value - * @see java.util.Map#put(Object, Object) - * @note some implementations do not support this method - * @deprecated use ORDERED_MAP#putAndMoveToLast instead (removed in 0.6.0) - */ - @Deprecated - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value); - - /** - * A specific move method to move a given key/value to the first index. - * @param key that should be moved to the first index - * @return true if the value was moved. - * @note returns false if the value was not present in the first place - * @note some implementations do not support this method - * @deprecated use ORDERED_MAP#moveToFirst instead (removed in 0.6.0) - */ - @Deprecated - public boolean moveToFirst(KEY_TYPE key); - /** - * A specific move method to move a given key/value to the last index. - * @param key that should be moved to the first last - * @return true if the value was moved. - * @note returns false if the value was not present in the first place - * @note some implementations do not support this method - * @deprecated use ORDERED_MAP#moveToLast instead (removed in 0.6.0) - */ - @Deprecated - public boolean moveToLast(KEY_TYPE key); - - /** - * A Specific get method that allows to move teh given key/value int the first index. - * @param key that is searched for - * @return the given value for the requested key or default return value - * @note some implementations do not support this method - * @deprecated use ORDERED_MAP#getAndMoveToFirst instead (removed in 0.6.0) - */ - @Deprecated - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key); - /** - * A Specific get method that allows to move teh given key/value int the last index. - * @param key that is searched for - * @return the given value for the requested key or default return value - * @note some implementations do not support this method - * @deprecated use ORDERED_MAP#getAndMoveToLast instead (removed in 0.6.0) - */ - @Deprecated - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key); - @Override public COMPARATOR KEY_GENERIC_TYPE comparator(); diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template index 54f4771..4b707f1 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template @@ -295,18 +295,6 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE } #endif - @Override - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - - @Override - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - - @Override - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - - @Override - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override public KEY_TYPE lower(KEY_TYPE e) { Entry KEY_GENERIC_TYPE node = findLowerNode(e); @@ -1203,15 +1191,6 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE return entry.key; } - @Override - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override public SubSet KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template index 2458ff4..d3d8570 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template @@ -3,7 +3,6 @@ package speiger.src.collections.PACKAGE.sets; import java.util.Arrays; import java.util.Collection; #if TYPE_OBJECT -import java.util.Comparator; import java.util.function.Consumer; import java.util.function.BiFunction; #endif @@ -21,7 +20,6 @@ import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUME import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.utils.ObjectArrays; #endif @@ -36,7 +34,7 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS; * This implementation does not shrink the backing array * @Type(T) */ -public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE, ORDERED_SET KEY_GENERIC_TYPE +public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { /** The Backing Array */ protected transient KEY_TYPE[] data; @@ -510,31 +508,6 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im throw new NoSuchElementException(); } - /** - * Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions. - * It is a Unsorted Sorted Set. Thats why the SubSet implementation will be disabled until a better solution is found. - * To give a simple reason: LinkedHashSets are also not SortedSets even so they could be. - * @throws UnsupportedOperationException because it is not supported - */ - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - /** - * Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions. - * It is a Unsorted Sorted Set. Thats why the SubSet implementation will be disabled until a better solution is found. - * To give a simple reason: LinkedHashSets are also not SortedSets even so they could be. - * @throws UnsupportedOperationException because it is not supported - */ - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - /** - * Unsupported for now. Implementation is buggy and does not support the Java Standard with these functions. - * It is a Unsorted Sorted Set. Thats why the SubSet implementation will be disabled until a better solution is found. - * To give a simple reason: LinkedHashSets are also not SortedSets even so they could be. - * @throws UnsupportedOperationException because it is not supported - */ - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } - public ARRAY_SET KEY_GENERIC_TYPE copy() { ARRAY_SET KEY_GENERIC_TYPE set = new ARRAY_SETBRACES(); set.data = Arrays.copyOf(data, data.length); @@ -542,11 +515,6 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im return set; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { - return null; - } - @Override public void clear() { size = 0; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template index 3acddb7..c89657e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template @@ -1,7 +1,6 @@ package speiger.src.collections.PACKAGE.sets; #if TYPE_OBJECT -import java.util.Comparator; import java.util.function.Consumer; import java.util.function.BiFunction; #endif @@ -15,7 +14,6 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; @@ -34,7 +32,7 @@ import speiger.src.collections.utils.SanityChecks; * Extra to that there is a couple quality of life functions provided * @Type(T) */ -public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE +public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { /** The Backing keys array */ protected transient KEY_TYPE[] keys; @@ -459,18 +457,6 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI return set; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } - @Override public void clear() { throw new UnsupportedOperationException(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template index b0278b7..00af862 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template @@ -1,7 +1,6 @@ package speiger.src.collections.PACKAGE.sets; #if TYPE_OBJECT -import java.util.Comparator; import java.util.function.Consumer; import java.util.function.BiFunction; #endif @@ -16,9 +15,6 @@ import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; #endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; -#if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; -#endif import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.utils.ITERATORS; @@ -37,7 +33,7 @@ import speiger.src.collections.utils.SanityChecks; * This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access * @Type(T) */ -public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE, ORDERED_SET KEY_GENERIC_TYPE +public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { /** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */ protected transient long[] links; @@ -672,18 +668,6 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY return set; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } - private class SetIterator implements LIST_ITERATOR KEY_GENERIC_TYPE { int previous = -1; int next = -1; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template index aa5622a..3288e3c 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template @@ -1,8 +1,5 @@ package speiger.src.collections.PACKAGE.sets; -#if TYPE_OBJECT -import java.util.Comparator; -#endif import java.util.Arrays; import java.util.Collection; import java.util.Iterator; @@ -19,7 +16,6 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR; #endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT -import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; @@ -38,7 +34,7 @@ import speiger.src.collections.utils.SanityChecks; * This implementation of SortedSet does not support SubSet of any kind. It implements the interface due to sortability and first/last access * @Type(T) */ -public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE, ORDERED_SET KEY_GENERIC_TYPE +public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { /** The Backing array for links between nodes. Left 32 Bits => Previous Entry, Right 32 Bits => Next Entry */ protected transient long[] links; @@ -643,18 +639,6 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE return set; } - @Override - public COMPARATOR KEY_GENERIC_TYPE comparator() { return null; } - - @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { throw new UnsupportedOperationException(); } - - @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { throw new UnsupportedOperationException(); } - private class SetIterator implements LIST_ITERATOR KEY_GENERIC_TYPE { int previous = -1; int next = -1; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template index 544f031..125a793 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template @@ -295,18 +295,6 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE } #endif - @Override - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - - @Override - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - - @Override - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - - @Override - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override public KEY_TYPE lower(KEY_TYPE e) { Entry KEY_GENERIC_TYPE node = findLowerNode(e); @@ -1264,15 +1252,6 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE return entry.key; } - @Override - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override public SubSet KEY_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template index e90a47b..884505d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template @@ -19,51 +19,8 @@ import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; * @note ORDERED_SET is only extended until 0.6.0 for Compat reasons. * The supported classes already implement ORDERED_SET directly and will remove SORTED_SET implementations in favor of ORDERED_SET instead */ -public interface SORTED_SET KEY_GENERIC_TYPE extends ORDERED_SET KEY_GENERIC_TYPE, SortedSet +public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, SortedSet { - - /** - * A customized add method that allows you to insert into the first index. - * @param o the element that should be inserted - * @return true if it was added - * @see java.util.Set#add(Object) - * @note some implementations do not support this method - * @deprecated use ORDERED_SET#addAndMoveToFirst instead (removed in 0.6.0) - */ - @Deprecated - public boolean addAndMoveToFirst(KEY_TYPE o); - /** - * A customized add method that allows you to insert into the last index. - * @param o the element that should be inserted - * @return true if it was added - * @see java.util.Set#add(Object) - * @note some implementations do not support this method - * @deprecated use ORDERED_SET#addAndMoveToLast instead (removed in 0.6.0) - */ - @Deprecated - public boolean addAndMoveToLast(KEY_TYPE o); - - /** - * A specific move method to move a given key to the first index. - * @param o that should be moved to the first index - * @return true if the value was moved. - * @note returns false if the value was not present in the first place - * @note some implementations do not support this method - * @deprecated use ORDERED_SET#moveToFirst instead (removed in 0.6.0) - */ - @Deprecated - public boolean moveToFirst(KEY_TYPE o); - /** - * A specific move method to move a given key to the last index. - * @param o that should be moved to the first last - * @return true if the value was moved. - * @note returns false if the value was not present in the first place - * @note some implementations do not support this method - * @deprecated use ORDERED_SET#moveToLast instead (removed in 0.6.0) - */ - @Deprecated - public boolean moveToLast(KEY_TYPE o); - /** * A Type Specific Comparator method * @return the type specific comparator diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template index 090b0c9..5eea645 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template @@ -360,18 +360,6 @@ public class SETS s = c; } - @Override - @Deprecated - public boolean addAndMoveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public boolean addAndMoveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public boolean moveToFirst(KEY_TYPE o) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public boolean moveToLast(KEY_TYPE o) { throw new UnsupportedOperationException(); } @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return s.comparator(); } @Override @@ -556,19 +544,7 @@ public class SETS super(c, mutex); s = c; } - - @Override - @Deprecated - public boolean addAndMoveToFirst(KEY_TYPE o) { synchronized(mutex) { return s.addAndMoveToFirst(o); } } - @Override - @Deprecated - public boolean addAndMoveToLast(KEY_TYPE o) { synchronized(mutex) { return s.addAndMoveToLast(o); } } - @Override - @Deprecated - public boolean moveToFirst(KEY_TYPE o) { synchronized(mutex) { return s.moveToFirst(o); } } - @Override - @Deprecated - public boolean moveToLast(KEY_TYPE o) { synchronized(mutex) { return s.moveToLast(o); } } + @Override public COMPARATOR KEY_GENERIC_TYPE comparator(){ synchronized(mutex) { return s.comparator(); } } @Override diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template b/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template index b5b56a5..51d807f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template @@ -517,24 +517,6 @@ public class MAPS this.map = map; } - @Override - @Deprecated - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public boolean moveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public boolean moveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { throw new UnsupportedOperationException(); } - @Override - @Deprecated - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { throw new UnsupportedOperationException(); } @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); } @Override @@ -833,24 +815,6 @@ public class MAPS this.map = map; } - @Override - @Deprecated - public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value) { synchronized(mutex) { return map.putAndMoveToFirst(key, value); } } - @Override - @Deprecated - public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value) { synchronized(mutex) { return map.putAndMoveToLast(key, value); } } - @Override - @Deprecated - public boolean moveToFirst(KEY_TYPE key) { synchronized(mutex) { return map.moveToFirst(key); } } - @Override - @Deprecated - public boolean moveToLast(KEY_TYPE key) { synchronized(mutex) { return map.moveToLast(key); } } - @Override - @Deprecated - public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key) { synchronized(mutex) { return map.getAndMoveToFirst(key); } } - @Override - @Deprecated - public VALUE_TYPE getAndMoveToLast(KEY_TYPE key) { synchronized(mutex) { return map.getAndMoveToLast(key); } } @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { synchronized(mutex) { return map.comparator(); } } @Override