Small fixes

-Fixed: NavigableMap.keySet is now a NavigableSet instead of a sorted one.
-Started: Trying to fix wrappers.
This commit is contained in:
Speiger 2022-06-02 14:59:39 +02:00
parent 1e7da394a1
commit 086d933a0d
7 changed files with 50 additions and 24 deletions

View File

@ -18,7 +18,7 @@ repositories {
}
archivesBaseName = 'Primitive Collections'
version = '0.6.2.8-SNAPSHOT';
version = '0.6.2.10-SNAPSHOT';
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();

View File

@ -30,8 +30,9 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP;
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
#if TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.SET;
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
#endif
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
@ -682,7 +683,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
}
@Override
public SORTED_SET KEY_GENERIC_TYPE keySet() {
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() {
return navigableKeySet();
}
@ -1474,7 +1475,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_
}
@Override
public SET KEY_GENERIC_TYPE keySet() {
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() {
return navigableKeySet();
}

View File

@ -30,8 +30,9 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP;
import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET;
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
#if TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.SET;
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
#endif
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION;
import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
@ -685,7 +686,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
}
@Override
public SORTED_SET KEY_GENERIC_TYPE keySet() {
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() {
return navigableKeySet();
}
@ -1310,6 +1311,11 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
return keySet;
}
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() {
return navigableKeySet();
}
@Override
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) {
if (!inRange(fromKey, fromInclusive)) throw new IllegalArgumentException("fromKey out of range");
@ -1396,6 +1402,11 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
return keySet;
}
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() {
return navigableKeySet();
}
@Override
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive) {
if (!inRange(fromKey, fromInclusive)) throw new IllegalArgumentException("fromKey out of range");
@ -1531,7 +1542,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G
}
@Override
public SET KEY_GENERIC_TYPE keySet() {
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() {
return navigableKeySet();
}

View File

@ -34,7 +34,9 @@ public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VAL
/** @return a Type Specific pollLastEntry */
@Override
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry();
/** @return a Type Specific Navigable Key Set */
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet();
/**
* Creates a Wrapped NavigableMap that is Synchronized
* @return a new NavigableMap that is synchronized

View File

@ -9,9 +9,11 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif
import speiger.src.collections.PACKAGE.sets.SET;
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
import speiger.src.collections.PACKAGE.utils.maps.MAPS;
#if !TYPE_OBJECT
import speiger.src.collections.objects.sets.ObjectSortedSet;
#endif
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
/**
@ -31,7 +33,7 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy();
@Override
public SET KEY_GENERIC_TYPE keySet();
public SORTED_SET KEY_GENERIC_TYPE keySet();
@Override
public VALUE_COLLECTION VALUE_GENERIC_TYPE values();

View File

@ -185,8 +185,8 @@ public class COLLECTIONS
#endif
@Override
public int hashCode() { synchronized(mutex) { return c.hashCode(); } }
@Override
public boolean equals(Object obj) { synchronized(mutex) { return c.equals(obj); } }
// @Override
// public boolean equals(Object obj) { synchronized(mutex) { return c.equals(obj); } }
@Override
public String toString() { synchronized(mutex) { return c.toString(); } }
@Override
@ -307,8 +307,8 @@ public class COLLECTIONS
#endif
@Override
public int hashCode() { return c.hashCode(); }
@Override
public boolean equals(Object obj) { return c.equals(obj); }
// @Override
// public boolean equals(Object obj) { return c.equals(obj); }
@Override
public String toString() { return c.toString(); }
@Override

View File

@ -34,6 +34,7 @@ import speiger.src.collections.PACKAGE.maps.interfaces.NAVIGABLE_MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.SORTED_MAP;
import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP;
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
import speiger.src.collections.PACKAGE.sets.SORTED_SET;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.sets.SET;
import speiger.src.collections.PACKAGE.utils.SETS;
@ -413,6 +414,8 @@ public class MAPS
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet() { return SETS.unmodifiable(map.navigableKeySet()); }
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { return SETS.unmodifiable(map.keySet()); }
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { return SETS.unmodifiable(map.descendingKeySet()); }
@Override
public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { return MAPS.unmodifiable(map.firstEntry()); }
@ -461,7 +464,7 @@ public class MAPS
@Override
public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key) { return MAPS.unmodifiable(map.ceilingEntry(key)); }
@Override
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); }
}
/**
@ -502,7 +505,7 @@ public class MAPS
@Override
public VALUE_TYPE LAST_ENTRY_VALUE() { return map.LAST_ENTRY_VALUE(); }
@Override
public ORDERED_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public ORDERED_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); }
}
/**
@ -526,6 +529,9 @@ public class MAPS
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey) { return MAPS.unmodifiable(map.headMap(toKey)); }
@Override
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return MAPS.unmodifiable(map.tailMap(fromKey)); }
@Override
public SORTED_SET KEY_GENERIC_TYPE keySet() { return SETS.unmodifiable(map.keySet()); }
@Override
public KEY_TYPE FIRST_ENTRY_KEY() { return map.FIRST_ENTRY_KEY(); }
@Override
@ -539,7 +545,7 @@ public class MAPS
@Override
public VALUE_TYPE LAST_ENTRY_VALUE() { return map.LAST_ENTRY_VALUE(); }
@Override
public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); }
}
/**
@ -582,7 +588,7 @@ public class MAPS
public VALUE_TYPE getOrDefault(KEY_TYPE key, VALUE_TYPE defaultValue) { return map.getOrDefault(key, defaultValue); }
#endif
@Override
public MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public MAP KEY_VALUE_GENERIC_TYPE copy() { return map.copy(); }
@Override
public SET KEY_GENERIC_TYPE keySet() {
@ -661,6 +667,8 @@ public class MAPS
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet() { synchronized(mutex) { return SETS.synchronize(map.descendingKeySet(), mutex); } }
@Override
public NAVIGABLE_SET KEY_GENERIC_TYPE keySet() { synchronized(mutex) { return SETS.synchronize(map.keySet(), mutex); } }
@Override
public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry() { synchronized(mutex) { return map.firstEntry(); } }
@Override
public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry() { synchronized(mutex) { return map.firstEntry(); } }
@ -697,7 +705,7 @@ public class MAPS
@Override
public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key) { synchronized(mutex) { return map.ceilingEntry(key); } }
@Override
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE copy() { synchronized(mutex) { return map.copy(); } }
#if !TYPE_OBJECT
@Override
@Deprecated
@ -795,7 +803,7 @@ public class MAPS
@Override
public VALUE_TYPE LAST_ENTRY_VALUE() { synchronized(mutex) { return map.LAST_ENTRY_VALUE(); } }
@Override
public ORDERED_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public ORDERED_MAP KEY_VALUE_GENERIC_TYPE copy() { synchronized(mutex) { return map.copy(); } }
}
/**
@ -825,6 +833,8 @@ public class MAPS
@Override
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { synchronized(mutex) { return MAPS.synchronize(map.tailMap(fromKey), mutex); } }
@Override
public SORTED_SET KEY_GENERIC_TYPE keySet() { synchronized(mutex) { return SETS.synchronize(map.keySet(), mutex); } }
@Override
public KEY_TYPE FIRST_ENTRY_KEY() { synchronized(mutex) { return map.FIRST_ENTRY_KEY(); } }
@Override
public KEY_TYPE POLL_FIRST_ENTRY_KEY() { synchronized(mutex) { return map.POLL_FIRST_ENTRY_KEY(); } }
@ -837,7 +847,7 @@ public class MAPS
@Override
public VALUE_TYPE LAST_ENTRY_VALUE() { synchronized(mutex) { return map.LAST_ENTRY_VALUE(); } }
@Override
public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public SORTED_MAP KEY_VALUE_GENERIC_TYPE copy() { synchronized(mutex) { return map.copy(); } }
#if !TYPE_OBJECT
@Override
@Deprecated
@ -951,9 +961,9 @@ public class MAPS
@Override
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action) { synchronized(mutex) { map.forEach(action); } }
@Override
public int size() { synchronized(mutex) { return super.size(); } }
public int size() { synchronized(mutex) { return map.size(); } }
@Override
public MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); }
public MAP KEY_VALUE_GENERIC_TYPE copy() { synchronized(mutex) { return map.copy(); } }
@Override
public SET KEY_GENERIC_TYPE keySet() {
if(keys == null) keys = SETS.synchronize(map.keySet(), mutex);