From f4c25c683f126b06747e962cf7f6338052574d59 Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 23 Jun 2021 18:53:40 +0200 Subject: [PATCH] Removed Suffixes of unmodifiable & synchronize methods. --- .../templates/utils/Collections.template | 10 +- .../templates/utils/Iterators.template | 14 +- .../templates/utils/Lists.template | 22 +-- .../collections/templates/utils/Sets.template | 46 +++---- .../templates/utils/maps/Maps.template | 126 +++++++++--------- .../ints/base/BaseIntCollectionTest.java | 4 +- .../ints/base/BaseIntListTest.java | 2 +- 7 files changed, 112 insertions(+), 112 deletions(-) diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template index 42e5672..ce53ed1 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -29,7 +29,7 @@ public class COLLECTIONS * @Type(T) * @return an empty collection */ - public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE emptyCollection() { + public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE empty() { #if TYPE_OBJECT return (COLLECTION)EMPTY; #else @@ -43,7 +43,7 @@ public class COLLECTIONS * @Type(T) * @return a unmodifiable collection wrapper. If the Collection already a unmodifiable wrapper then it just returns itself. */ - public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE unmodifiableCollection(COLLECTION KEY_GENERIC_TYPE c) { + public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE unmodifiable(COLLECTION KEY_GENERIC_TYPE c) { return c instanceof UnmodifiableCollection ? c : new UnmodifiableCollectionBRACES(c); } @@ -53,7 +53,7 @@ public class COLLECTIONS * @Type(T) * @return a synchronized collection wrapper. If the Collection already a synchronized wrapper then it just returns itself. */ - public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE synchronizedCollection(COLLECTION KEY_GENERIC_TYPE c) { + public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE synchronize(COLLECTION KEY_GENERIC_TYPE c) { return c instanceof SynchronizedCollection ? c : new SynchronizedCollectionBRACES(c); } @@ -64,7 +64,7 @@ public class COLLECTIONS * @Type(T) * @return a synchronized collection wrapper. If the Collection already a synchronized wrapper then it just returns itself. */ - public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE synchronizedCollection(COLLECTION KEY_GENERIC_TYPE c, Object mutex) { + public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE synchronize(COLLECTION KEY_GENERIC_TYPE c, Object mutex) { return c instanceof SynchronizedCollection ? c : new SynchronizedCollectionBRACES(c, mutex); } @@ -408,7 +408,7 @@ public class COLLECTIONS #endif @Override public ITERATOR KEY_GENERIC_TYPE iterator() { - return ITERATORS.emptyIterator(); + return ITERATORS.empty(); } @Override diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index ebfef94..9f585b9 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -20,7 +20,7 @@ public class ITERATORS * @Type(T) * @return an empty iterator */ - public static GENERIC_KEY_BRACES EmptyIterator KEY_GENERIC_TYPE emptyIterator() { + public static GENERIC_KEY_BRACES EmptyIterator KEY_GENERIC_TYPE empty() { #if TYPE_OBJECT return (EmptyIterator)EMPTY; #else @@ -50,9 +50,9 @@ public class ITERATORS /** * Returns a Immutable Iterator instance based on the instance given. - * @param iterator that should be made immutable/unmodifyable + * @param iterator that should be made immutable/unmodifiable * @Type(T) - * @return a unmodifiable iterator wrapper. If the Iterator already a unmodifyable wrapper then it just returns itself. + * @return a unmodifiable iterator wrapper. If the Iterator already a unmodifiable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES ITERATOR KEY_GENERIC_TYPE unmodifiable(ITERATOR KEY_GENERIC_TYPE iterator) { return iterator instanceof UnmodifiableIterator ? iterator : new UnmodifiableIteratorBRACES(iterator); @@ -60,9 +60,9 @@ public class ITERATORS /** * Returns a Immutable Iterator instance based on the instance given. - * @param iterator that should be made immutable/unmodifyable + * @param iterator that should be made immutable/unmodifiable * @Type(T) - * @return a unmodifiable iterator wrapper. If the Iterator already a unmodifyable wrapper then it just returns itself. + * @return a unmodifiable iterator wrapper. If the Iterator already a unmodifiable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES BI_ITERATOR KEY_GENERIC_TYPE unmodifiable(BI_ITERATOR KEY_GENERIC_TYPE iterator) { return iterator instanceof UnmodifiableBiIterator ? iterator : new UnmodifiableBiIteratorBRACES(iterator); @@ -70,9 +70,9 @@ public class ITERATORS /** * Returns a Immutable ListIterator instance based on the instance given. - * @param iterator that should be made immutable/unmodifyable + * @param iterator that should be made immutable/unmodifiable * @Type(T) - * @return a unmodifiable listiterator wrapper. If the ListIterator already a unmodifyable wrapper then it just returns itself. + * @return a unmodifiable listiterator wrapper. If the ListIterator already a unmodifiable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST_ITERATOR KEY_GENERIC_TYPE unmodifiable(LIST_ITERATOR KEY_GENERIC_TYPE iterator) { return iterator instanceof UnmodifiableListIterator ? iterator : new UnmodifiableListIteratorBRACES(iterator); diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template index 9f7a6fb..3e5f452 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template @@ -28,7 +28,7 @@ public class LISTS * @Type(T) * @return an empty list */ - public static GENERIC_KEY_BRACES EmptyList KEY_GENERIC_TYPE emptyList() { + public static GENERIC_KEY_BRACES EmptyList KEY_GENERIC_TYPE empty() { #if TYPE_OBJECT return (EmptyList)EMPTY; #else @@ -38,11 +38,11 @@ public class LISTS /** * Returns a Immutable List instance based on the instance given. - * @param l that should be made immutable/unmodifyable + * @param l that should be made immutable/unmodifiable * @Type(T) - * @return a unmodifiable list wrapper. If the list is implementing RandomAccess that is also transferred. If the List already a unmodifyable wrapper then it just returns itself. + * @return a unmodifiable list wrapper. If the list is implementing RandomAccess that is also transferred. If the List already a unmodifiable wrapper then it just returns itself. */ - public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE unmodifiableList(LIST KEY_GENERIC_TYPE l) { + public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE unmodifiable(LIST KEY_GENERIC_TYPE l) { return l instanceof UnmodifiableList ? l : l instanceof RandomAccess ? new UnmodifiableRandomListBRACES(l) : new UnmodifiableListBRACES(l); } @@ -52,7 +52,7 @@ public class LISTS * @Type(T) * @return a synchronized list wrapper. If the list is implementing RandomAccess or IARRAY that is also transferred. If the List already a synchronized wrapper then it just returns itself. */ - public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronizedList(LIST KEY_GENERIC_TYPE l) { + public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronize(LIST KEY_GENERIC_TYPE l) { return l instanceof SynchronizedList ? l : (l instanceof IARRAY ? new SynchronizedArrayListBRACES(l) : (l instanceof RandomAccess ? new SynchronizedRandomAccessListBRACES(l) : new SynchronizedListBRACES(l))); } @@ -63,7 +63,7 @@ public class LISTS * @Type(T) * @return a synchronized list wrapper. If the list is implementing RandomAccess or IARRAY that is also transferred. If the List already a synchronized wrapper then it just returns itself. */ - public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronizedList(LIST KEY_GENERIC_TYPE l, Object mutex) { + public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronize(LIST KEY_GENERIC_TYPE l, Object mutex) { return l instanceof SynchronizedList ? l : (l instanceof IARRAY ? new SynchronizedArrayListBRACES(l, mutex) : (l instanceof RandomAccess ? new SynchronizedRandomAccessListBRACES(l, mutex) : new SynchronizedListBRACES(l, mutex))); } @@ -73,7 +73,7 @@ public class LISTS * @Type(T) * @return a singleton list that is unmodifiable */ - public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE singletonList(KEY_TYPE element) { + public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE singleton(KEY_TYPE element) { return new SingletonListBRACES(element); } @@ -275,7 +275,7 @@ public class LISTS @Override public LIST KEY_GENERIC_TYPE subList(int from, int to) { - return synchronizedList(l.subList(from, to)); + return synchronize(l.subList(from, to)); } @Override @@ -384,7 +384,7 @@ public class LISTS @Override public LIST KEY_GENERIC_TYPE subList(int from, int to) { - return unmodifiableList(l.subList(from, to)); + return unmodifiable(l.subList(from, to)); } @Override @@ -456,14 +456,14 @@ public class LISTS #endif @Override public LIST_ITERATOR KEY_GENERIC_TYPE listIterator() { - return ITERATORS.emptyIterator(); + return ITERATORS.empty(); } @Override public LIST_ITERATOR KEY_GENERIC_TYPE listIterator(int index) { if(index != 0) throw new IndexOutOfBoundsException(); - return ITERATORS.emptyIterator(); + return ITERATORS.empty(); } @Override 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 e33ff28..1013aed 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template @@ -56,7 +56,7 @@ public class SETS * @return a set that is synchronized * @note if the set is already synchronized then it will just self return it */ - public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE synchronizedSet(SET KEY_GENERIC_TYPE s) { + public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE synchronize(SET KEY_GENERIC_TYPE s) { return s instanceof SynchronizedSet ? s : (s instanceof ITrimmable ? new SynchronizedTrimSetBRACES(s) : new SynchronizedSetBRACES(s)); } @@ -68,7 +68,7 @@ public class SETS * @return a set that is synchronized * @note if the set is already synchronized then it will just self return it */ - public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE synchronizedSet(SET KEY_GENERIC_TYPE s, Object mutex) { + public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE synchronize(SET KEY_GENERIC_TYPE s, Object mutex) { return s instanceof SynchronizedSet ? s : (s instanceof ITrimmable ? new SynchronizedTrimSetBRACES(s, mutex) : new SynchronizedSetBRACES(s, mutex)); } @@ -79,7 +79,7 @@ public class SETS * @return a SortedSet that is synchronized * @note if the set is already synchronized then it will just self return it */ - public static GENERIC_KEY_BRACES SORTED_SET KEY_GENERIC_TYPE synchronizedSet(SORTED_SET KEY_GENERIC_TYPE s) { + public static GENERIC_KEY_BRACES SORTED_SET KEY_GENERIC_TYPE synchronize(SORTED_SET KEY_GENERIC_TYPE s) { return s instanceof SynchronizedSortedSet ? s : (s instanceof ITrimmable ? new SynchronizedSortedTrimSetBRACES(s) : new SynchronizedSortedSetBRACES(s)); } @@ -91,7 +91,7 @@ public class SETS * @return a SortedSet that is synchronized * @note if the set is already synchronized then it will just self return it */ - public static GENERIC_KEY_BRACES SORTED_SET KEY_GENERIC_TYPE synchronizedSet(SORTED_SET KEY_GENERIC_TYPE s, Object mutex) { + public static GENERIC_KEY_BRACES SORTED_SET KEY_GENERIC_TYPE synchronize(SORTED_SET KEY_GENERIC_TYPE s, Object mutex) { return s instanceof SynchronizedSortedSet ? s : (s instanceof ITrimmable ? new SynchronizedSortedTrimSetBRACES(s, mutex) : new SynchronizedSortedSetBRACES(s, mutex)); } @@ -102,7 +102,7 @@ public class SETS * @return a NavigableSet that is synchronized * @note if the set is already synchronized then it will just self return it */ - public static GENERIC_KEY_BRACES NAVIGABLE_SET KEY_GENERIC_TYPE synchronizedSet(NAVIGABLE_SET KEY_GENERIC_TYPE s) { + public static GENERIC_KEY_BRACES NAVIGABLE_SET KEY_GENERIC_TYPE synchronize(NAVIGABLE_SET KEY_GENERIC_TYPE s) { return s instanceof SynchronizedNavigableSet ? s : (s instanceof ITrimmable ? new SynchronizedNavigableTrimSetBRACES(s) : new SynchronizedNavigableSetBRACES(s)); } @@ -114,15 +114,15 @@ public class SETS * @return a NavigableSet that is synchronized * @note if the set is already synchronized then it will just self return it */ - public static GENERIC_KEY_BRACES NAVIGABLE_SET KEY_GENERIC_TYPE synchronizedSet(NAVIGABLE_SET KEY_GENERIC_TYPE s, Object mutex) { + public static GENERIC_KEY_BRACES NAVIGABLE_SET KEY_GENERIC_TYPE synchronize(NAVIGABLE_SET KEY_GENERIC_TYPE s, Object mutex) { return s instanceof SynchronizedNavigableSet ? s : (s instanceof ITrimmable ? new SynchronizedNavigableTrimSetBRACES(s, mutex) : new SynchronizedNavigableSetBRACES(s, mutex)); } /** * Creates Unmodifyable Set wrapper - * @param s set that should be made unmodifyable + * @param s set that should be made unmodifiable * @Type(T) - * @return a UnmodifyableSet, if the set is already unmodifyable then it returns itself + * @return a UnmodifyableSet, if the set is already unmodifiable then it returns itself */ public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE unmodifiable(SET KEY_GENERIC_TYPE s) { return s instanceof UnmodifiableSet ? s : new UnmodifiableSetBRACES(s); @@ -130,9 +130,9 @@ public class SETS /** * Creates Unmodifyable SortedSet wrapper - * @param s sortedSet that should be made unmodifyable + * @param s sortedSet that should be made unmodifiable * @Type(T) - * @return a UnmodifyableSortedSet, if the set is already unmodifyable then it returns itself + * @return a UnmodifyableSortedSet, if the set is already unmodifiable then it returns itself */ public static GENERIC_KEY_BRACES SORTED_SET KEY_GENERIC_TYPE unmodifiable(SORTED_SET KEY_GENERIC_TYPE s) { return s instanceof UnmodifiableSortedSet ? s : new UnmodifiableSortedSetBRACES(s); @@ -140,9 +140,9 @@ public class SETS /** * Creates Unmodifyable NavigableSet wrapper - * @param s navigableSet that should be made unmodifyable + * @param s navigableSet that should be made unmodifiable * @Type(T) - * @return a UnmodifyableNavigableSet, if the set is already unmodifyable then it returns itself + * @return a UnmodifyableNavigableSet, if the set is already unmodifiable then it returns itself */ public static GENERIC_KEY_BRACES NAVIGABLE_SET KEY_GENERIC_TYPE unmodifiable(NAVIGABLE_SET KEY_GENERIC_TYPE s) { return s instanceof UnmodifiableNavigableSet ? s : new UnmodifiableNavigableSetBRACES(s); @@ -155,7 +155,7 @@ public class SETS * @Type(T) * @return a singletonset of the given element */ - public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE singletonSet(KEY_TYPE element) { + public static GENERIC_KEY_BRACES SET KEY_GENERIC_TYPE singleton(KEY_TYPE element) { return new SingletonSetBRACES(element); } @@ -413,28 +413,28 @@ public class SETS #endif @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, boolean fromInclusive, KEY_TYPE toElement, boolean toInclusive) { synchronized(mutex) { return synchronizedSet(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 synchronize(n.subSet(fromElement, fromInclusive, toElement, toInclusive), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement, boolean inclusive) { synchronized(mutex) { return synchronizedSet(n.headSet(toElement, inclusive), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement, boolean inclusive) { synchronized(mutex) { return synchronize(n.headSet(toElement, inclusive), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement, boolean inclusive) { synchronized(mutex) { return synchronizedSet(n.tailSet(fromElement, inclusive), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement, boolean inclusive) { synchronized(mutex) { return synchronize(n.tailSet(fromElement, inclusive), mutex); } } @Override public BI_ITERATOR KEY_GENERIC_TYPE descendingIterator() { synchronized(mutex) { return n.descendingIterator(); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE descendingSet() { synchronized(mutex) { return synchronizedSet(n.descendingSet(), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE descendingSet() { synchronized(mutex) { return synchronize(n.descendingSet(), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return synchronizedSet(n.subSet(fromElement, toElement), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return synchronize(n.subSet(fromElement, toElement), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return synchronizedSet(n.headSet(toElement), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return synchronize(n.headSet(toElement), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return synchronizedSet(n.tailSet(fromElement), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return synchronize(n.tailSet(fromElement), mutex); } } } private static class SynchronizedSortedTrimSet KEY_GENERIC_TYPE extends SynchronizedSortedSet KEY_GENERIC_TYPE implements ITrimmable @@ -494,13 +494,13 @@ public class SETS public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement) { synchronized(mutex) { return s.iterator(fromElement); } } @Override - public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return synchronizedSet(s.subSet(fromElement, toElement), mutex); } } + public SORTED_SET KEY_GENERIC_TYPE subSet(KEY_TYPE fromElement, KEY_TYPE toElement) { synchronized(mutex) { return synchronize(s.subSet(fromElement, toElement), mutex); } } @Override - public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return synchronizedSet(s.headSet(toElement), mutex); } } + public SORTED_SET KEY_GENERIC_TYPE headSet(KEY_TYPE toElement) { synchronized(mutex) { return synchronize(s.headSet(toElement), mutex); } } @Override - public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return synchronizedSet(s.tailSet(fromElement), mutex); } } + public SORTED_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { synchronized(mutex) { return synchronize(s.tailSet(fromElement), mutex); } } @Override public KEY_TYPE FIRST_KEY() { synchronized(mutex) { return s.FIRST_KEY(); } } 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 048de94..d4bfe59 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 @@ -110,7 +110,7 @@ public class MAPS * @ValueType(V) * @return empty map of desired type */ - public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE emptyMap() { + public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE empty() { #if TYPE_OBJECT || VALUE_OBJECT return (MAP KEY_VALUE_GENERIC_TYPE)EMPTY; #else @@ -127,7 +127,7 @@ public class MAPS * @note if the inputted map is already synchronized then it will just return it instead * @note iterators do not support synchronization */ - public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE synchronizeMap(MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof SynchronizedMap ? map : new SynchronizedMapKV_BRACES(map); } + public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE synchronize(MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof SynchronizedMap ? map : new SynchronizedMapKV_BRACES(map); } /** * Helper function that creates a Helper wrapper to synchronize access with custom access control into the map. * @param map the map that should be synchronized @@ -138,7 +138,7 @@ public class MAPS * @note if the inputted map is already synchronized then it will just return it instead * @note iterators do not support synchronization */ - public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE synchronizeMap(MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedMap ? map : new SynchronizedMapKV_BRACES(map, mutex); } + public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE synchronize(MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedMap ? map : new SynchronizedMapKV_BRACES(map, mutex); } /** * Helper function that creates a Helper wrapper to synchronize access into the SortedMap. @@ -149,7 +149,7 @@ public class MAPS * @note if the inputted map is already synchronized then it will just return it instead * @note iterators do not support synchronization */ - public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronizeMap(SORTED_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof SynchronizedSortedMap ? map : new SynchronizedSortedMapKV_BRACES(map); } + public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronize(SORTED_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof SynchronizedSortedMap ? map : new SynchronizedSortedMapKV_BRACES(map); } /** * Helper function that creates a Helper wrapper to synchronize access with custom access control into the SortedMap. * @param map the SortedMap that should be synchronized @@ -160,7 +160,7 @@ public class MAPS * @note if the inputted map is already synchronized then it will just return it instead * @note iterators do not support synchronization */ - public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronizeMap(SORTED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedSortedMap ? map : new SynchronizedSortedMapKV_BRACES(map, mutex); } + public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE synchronize(SORTED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedSortedMap ? map : new SynchronizedSortedMapKV_BRACES(map, mutex); } /** * Helper function that creates a Helper wrapper to synchronize access into the NavigableMap. @@ -171,7 +171,7 @@ public class MAPS * @note if the inputted map is already synchronized then it will just return it instead * @note iterators do not support synchronization */ - public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronizeMap(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof SynchronizedNavigableMap ? map : new SynchronizedNavigableMapKV_BRACES(map); } + public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronize(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof SynchronizedNavigableMap ? map : new SynchronizedNavigableMapKV_BRACES(map); } /** * Helper function that creates a Helper wrapper to synchronize access with custom access control into the NavigableMap. * @param map the NavigableMap that should be synchronized @@ -182,7 +182,7 @@ public class MAPS * @note if the inputted map is already synchronized then it will just return it instead * @note iterators do not support synchronization */ - public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronizeMap(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedNavigableMap ? map : new SynchronizedNavigableMapKV_BRACES(map, mutex); } + public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE synchronize(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedNavigableMap ? map : new SynchronizedNavigableMapKV_BRACES(map, mutex); } /** * A Helper function that creates a Helper wrapper to only allow Read Access into the Map @@ -192,7 +192,7 @@ public class MAPS * @return a unmodifiable Map * @note if the inputted map is already unmodifiable then it will just return it instead */ - public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE unmodifyableMap(MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableMap ? map : new UnmodifyableMapKV_BRACES(map); } + public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE unmodifiable(MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableMap ? map : new UnmodifyableMapKV_BRACES(map); } /** * A Helper function that creates a Helper wrapper to only allow Read Access into the SortedMap * @param map the SortedMap that should be made Unmodifiable @@ -201,7 +201,7 @@ public class MAPS * @return a unmodifiable SortedMap * @note if the inputted SortedMap is already unmodifiable then it will just return it instead */ - public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE unmodifyableMap(SORTED_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableSortedMap ? map : new UnmodifyableSortedMapKV_BRACES(map); } + public static GENERIC_KEY_VALUE_BRACES SORTED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable(SORTED_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableSortedMap ? map : new UnmodifyableSortedMapKV_BRACES(map); } /** * A Helper function that creates a Helper wrapper to only allow Read Access into NavigableMap Map * @param map the NavigableMap that should be made Unmodifiable @@ -210,23 +210,23 @@ public class MAPS * @return a unmodifiable NavigableMap * @note if the inputted NavigableMap is already unmodifiable then it will just return it instead */ - public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifyableMap(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableNavigableMap ? map : new UnmodifyableNavigableMapKV_BRACES(map); } + public static GENERIC_KEY_VALUE_BRACES NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE unmodifiable(NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE map) { return map instanceof UnmodifyableNavigableMap ? map : new UnmodifyableNavigableMapKV_BRACES(map); } /** * A Helper function that creates a Unmodifyable Entry - * @param entry the Entry that should be made unmodifyable + * @param entry the Entry that should be made unmodifiable * @Type(T) * @ValueType(V) * @return a Unmodifyable Entry */ - public static GENERIC_KEY_VALUE_BRACES MAP.Entry KEY_VALUE_GENERIC_TYPE unmodifyableEntry(MAP.Entry KEY_VALUE_GENERIC_TYPE entry) { return entry instanceof UnmodifyableEntry ? entry : new UnmodifyableEntryKV_BRACES(entry); } + public static GENERIC_KEY_VALUE_BRACES MAP.Entry KEY_VALUE_GENERIC_TYPE unmodifiable(MAP.Entry KEY_VALUE_GENERIC_TYPE entry) { return entry instanceof UnmodifyableEntry ? entry : new UnmodifyableEntryKV_BRACES(entry); } /** * A Helper function that creates a Unmodifyable Entry - * @param entry the Entry that should be made unmodifyable + * @param entry the Entry that should be made unmodifiable * @Type(T) * @ValueType(V) * @return a Unmodifyable Entry */ - public static GENERIC_KEY_VALUE_BRACES MAP.Entry KEY_VALUE_GENERIC_TYPE unmodifyableEntry(Map.Entry entry) { return entry instanceof UnmodifyableEntry ? (UnmodifyableEntry KEY_VALUE_GENERIC_TYPE)entry : new UnmodifyableEntryKV_BRACES(entry); } + public static GENERIC_KEY_VALUE_BRACES MAP.Entry KEY_VALUE_GENERIC_TYPE unmodifiable(Map.Entry entry) { return entry instanceof UnmodifyableEntry ? (UnmodifyableEntry KEY_VALUE_GENERIC_TYPE)entry : new UnmodifyableEntryKV_BRACES(entry); } /** * Creates a Singleton map from the provided values. @@ -235,9 +235,9 @@ public class MAPS * @param value the value that should be turned into a singleton * @Type(T) * @ValueType(V) - * @return a unmodifyable Singleton map. + * @return a unmodifiable Singleton map. */ - public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE singletonMap(KEY_TYPE key, VALUE_TYPE value) { return new SingletonMapKV_BRACES(key, value); } + public static GENERIC_KEY_VALUE_BRACES MAP KEY_VALUE_GENERIC_TYPE singleton(KEY_TYPE key, VALUE_TYPE value) { return new SingletonMapKV_BRACES(key, value); } /** * Singleton Map instance that is used in the helper method @@ -280,18 +280,18 @@ public class MAPS #endif @Override public SET KEY_GENERIC_TYPE keySet() { - if(keySet == null) keySet = SETS.singletonSet(key); + if(keySet == null) keySet = SETS.singleton(key); return keySet; } @Override public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { - if(values == null) values = VALUE_SETS.singletonSet(value); + if(values == null) values = VALUE_SETS.singleton(value); return values; } @Override public ObjectSet ENTRY_SET() { - if(entrySet == null) entrySet = ObjectSets.singletonSet(new ABSTRACT_MAP.BasicEntryKV_BRACES(key, value)); + if(entrySet == null) entrySet = ObjectSets.singleton(new ABSTRACT_MAP.BasicEntryKV_BRACES(key, value)); return entrySet; } } @@ -327,7 +327,7 @@ public class MAPS @Override public SET KEY_GENERIC_TYPE keySet() { return SETS.empty(); } @Override - public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { return VALUE_COLLECTIONS.emptyCollection(); } + public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { return VALUE_COLLECTIONS.empty(); } @Override public ObjectSet ENTRY_SET() { return ObjectSets.empty(); } } @@ -365,31 +365,31 @@ public class MAPS } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { return unmodifyableMap(map.descendingMap()); } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { return synchronize(map.descendingMap()); } @Override public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { return SETS.unmodifiable(map.navigableKeySet()); } @Override public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { return SETS.unmodifiable(map.descendingKeySet()); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { return unmodifyableEntry(map.firstEntry()); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { return unmodifiable(map.firstEntry()); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry() { return unmodifyableEntry(map.lastEntry()); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry() { return unmodifiable(map.lastEntry()); } @Override public MAP.Entry KEY_VALUE_GENERIC_TYPE pollFirstEntry() { throw new UnsupportedOperationException(); } @Override public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry() { throw new UnsupportedOperationException(); } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { return unmodifyableMap(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 unmodifiable(map.subMap(fromKey, fromInclusive, toKey, toInclusive)); } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { return unmodifyableMap(map.headMap(toKey, inclusive)); } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { return unmodifiable(map.headMap(toKey, inclusive)); } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { return unmodifyableMap(map.tailMap(fromKey, inclusive)); } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { return unmodifiable(map.tailMap(fromKey, inclusive)); } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return unmodifyableMap(map.subMap(fromKey, toKey)); } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return unmodifiable(map.subMap(fromKey, toKey)); } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return unmodifyableMap(map.headMap(toKey)); } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return unmodifiable(map.headMap(toKey)); } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return unmodifyableMap(map.tailMap(fromKey)); } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return unmodifiable(map.tailMap(fromKey)); } #if !TYPE_OBJECT @Override public void setDefaultMaxValue(KEY_TYPE e) { throw new UnsupportedOperationException(); } @@ -409,13 +409,13 @@ public class MAPS @Override public KEY_TYPE ceilingKey(KEY_TYPE key) { return map.ceilingKey(key); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(KEY_TYPE key) { return unmodifyableEntry(map.lowerEntry(key)); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(KEY_TYPE key) { return unmodifiable(map.lowerEntry(key)); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(KEY_TYPE key) { return unmodifyableEntry(map.higherEntry(key)); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(KEY_TYPE key) { return unmodifiable(map.higherEntry(key)); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(KEY_TYPE key) { return unmodifyableEntry(map.floorEntry(key)); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(KEY_TYPE key) { return unmodifiable(map.floorEntry(key)); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key) { return unmodifyableEntry(map.ceilingEntry(key)); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key) { return unmodifiable(map.ceilingEntry(key)); } } /** @@ -446,11 +446,11 @@ public class MAPS @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { return map.comparator(); } @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return unmodifyableMap(map.subMap(fromKey, toKey)); } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { return unmodifiable(map.subMap(fromKey, toKey)); } @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return unmodifyableMap(map.headMap(toKey)); } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return unmodifiable(map.headMap(toKey)); } @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return unmodifyableMap(map.tailMap(fromKey)); } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return unmodifiable(map.tailMap(fromKey)); } @Override public KEY_TYPE FIRST_ENTRY_KEY() { return map.FIRST_ENTRY_KEY(); } @Override @@ -511,7 +511,7 @@ public class MAPS @Override public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { - if(values == null) values = VALUE_COLLECTIONS.unmodifiableCollection(map.values()); + if(values == null) values = VALUE_COLLECTIONS.unmodifiable(map.values()); return values; } @@ -539,7 +539,7 @@ public class MAPS @Override public void forEach(Consumer action) { - s.forEach(T -> action.accept(unmodifyableEntry(T))); + s.forEach(T -> action.accept(unmodifiable(T))); } @Override @@ -549,7 +549,7 @@ public class MAPS @Override public boolean hasNext() { return iter.hasNext(); } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE next() { return unmodifyableEntry(iter.next()); } + public MAP.Entry KEY_VALUE_GENERIC_TYPE next() { return unmodifiable(iter.next()); } }; } @@ -574,11 +574,11 @@ public class MAPS } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { synchronized(mutex) { return synchronizeMap(map.descendingMap(), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap() { synchronized(mutex) { return synchronize(map.descendingMap(), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { synchronized(mutex) { return SETS.synchronizedSet(map.navigableKeySet(), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { synchronized(mutex) { return SETS.synchronize(map.navigableKeySet(), mutex); } } @Override - public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { synchronized(mutex) { return SETS.synchronizedSet(map.descendingKeySet(), mutex); } } + public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { synchronized(mutex) { return SETS.synchronize(map.descendingKeySet(), mutex); } } @Override public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { synchronized(mutex) { return map.firstEntry(); } } @Override @@ -588,17 +588,17 @@ public class MAPS @Override public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry() { synchronized(mutex) { return map.pollLastEntry(); } } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) { synchronized(mutex) { return synchronizeMap(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 synchronize(map.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { synchronized(mutex) { return synchronizeMap(map.headMap(toKey, inclusive), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.headMap(toKey, inclusive), mutex); } } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return synchronizeMap(map.tailMap(fromKey, inclusive), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.tailMap(fromKey, inclusive), mutex); } } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.subMap(fromKey, toKey), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.headMap(toKey), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } } @Override - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return synchronizeMap(map.tailMap(fromKey), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } } @Override public KEY_TYPE lowerKey(KEY_TYPE key) { synchronized(mutex) { return map.lowerKey(key); } } @Override @@ -618,22 +618,22 @@ public class MAPS #if !TYPE_OBJECT @Override @Deprecated - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, boolean fromInclusive, CLASS_TYPE toKey, boolean toInclusive) { synchronized(mutex) { return synchronizeMap(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 synchronize(map.subMap(fromKey, fromInclusive, toKey, toInclusive), mutex); } } @Override @Deprecated - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey, boolean inclusive) { synchronized(mutex) { return synchronizeMap(map.headMap(toKey, inclusive), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.headMap(toKey, inclusive), mutex); } } @Override @Deprecated - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return synchronizeMap(map.tailMap(fromKey, inclusive), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey, boolean inclusive) { synchronized(mutex) { return synchronize(map.tailMap(fromKey, inclusive), mutex); } } @Override @Deprecated - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.subMap(fromKey, toKey), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } } @Override @Deprecated - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.headMap(toKey), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } } @Override @Deprecated - public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return synchronizeMap(map.tailMap(fromKey), mutex); } } + public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } } @Override public void setDefaultMaxValue(KEY_TYPE e) { synchronized(mutex) { map.setDefaultMaxValue(e); } } @Override @@ -702,11 +702,11 @@ public class MAPS @Override public COMPARATOR KEY_GENERIC_TYPE comparator() { synchronized(mutex) { return map.comparator(); } } @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.subMap(fromKey, toKey), mutex); } } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } } @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.headMap(toKey), mutex); } } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } } @Override - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return synchronizeMap(map.tailMap(fromKey), mutex); } } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } } @Override public KEY_TYPE FIRST_ENTRY_KEY() { synchronized(mutex) { return map.FIRST_ENTRY_KEY(); } } @Override @@ -728,13 +728,13 @@ public class MAPS public CLASS_TYPE lastKey() { synchronized(mutex) { return map.lastKey(); } } @Override @Deprecated - public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.subMap(fromKey, toKey), mutex); } } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.subMap(fromKey, toKey), mutex); } } @Override @Deprecated - public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return synchronizeMap(map.headMap(toKey), mutex); } } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { synchronized(mutex) { return synchronize(map.headMap(toKey), mutex); } } @Override @Deprecated - public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return synchronizeMap(map.tailMap(fromKey), mutex); } } + public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { synchronized(mutex) { return synchronize(map.tailMap(fromKey), mutex); } } #endif } @@ -833,19 +833,19 @@ public class MAPS public int size() { synchronized(mutex) { return super.size(); } } @Override public SET KEY_GENERIC_TYPE keySet() { - if(keys == null) keys = SETS.synchronizedSet(map.keySet(), mutex); + if(keys == null) keys = SETS.synchronize(map.keySet(), mutex); return keys; } @Override public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { - if(values == null) values = VALUE_COLLECTIONS.synchronizedCollection(map.values(), mutex); + if(values == null) values = VALUE_COLLECTIONS.synchronize(map.values(), mutex); return values; } @Override public ObjectSet ENTRY_SET() { - if(entrySet == null) entrySet = ObjectSets.synchronizedSet(map.ENTRY_SET(), mutex); + if(entrySet == null) entrySet = ObjectSets.synchronize(map.ENTRY_SET(), mutex); return entrySet; } diff --git a/src/test/java/speiger/src/collections/ints/base/BaseIntCollectionTest.java b/src/test/java/speiger/src/collections/ints/base/BaseIntCollectionTest.java index d57f2b5..7dcedfb 100644 --- a/src/test/java/speiger/src/collections/ints/base/BaseIntCollectionTest.java +++ b/src/test/java/speiger/src/collections/ints/base/BaseIntCollectionTest.java @@ -158,9 +158,9 @@ public abstract class BaseIntCollectionTest extends BaseIntIterableTest public void testWrapper() { if(!getValidCollectionTests().contains(CollectionTest.WRAPPER)) return; IntCollection collection = create(TEST_ARRAY); - collection = IntCollections.synchronizedCollection(collection); + collection = IntCollections.synchronize(collection); Assert.assertTrue(collection instanceof SynchronizedCollection); - collection = IntCollections.unmodifiableCollection(collection); + collection = IntCollections.unmodifiable(collection); Assert.assertTrue(collection instanceof UnmodifiableCollection); } } \ No newline at end of file diff --git a/src/test/java/speiger/src/collections/ints/base/BaseIntListTest.java b/src/test/java/speiger/src/collections/ints/base/BaseIntListTest.java index 6d3053d..f903da8 100644 --- a/src/test/java/speiger/src/collections/ints/base/BaseIntListTest.java +++ b/src/test/java/speiger/src/collections/ints/base/BaseIntListTest.java @@ -42,7 +42,7 @@ public abstract class BaseIntListTest extends BaseIntCollectionTest if(getValidListTests().contains(ListTest.ADD_INDEX_COLLECTION)) return; IntList list = create(TEST_ARRAY); IntList adding = create(ADD_ARRAY); - list.addAll(0, IntCollections.unmodifiableCollection(adding)); + list.addAll(0, IntCollections.unmodifiable(adding)); for(int i = 0;i