Maps.get function is no longer using Suffixes unless its absolutely

necessary.
This commit is contained in:
Speiger 2021-06-23 19:34:32 +02:00
parent 357b40e670
commit ce8f49cd1f
4 changed files with 13 additions and 11 deletions

View File

@ -6,4 +6,5 @@
- Changed: remove/removeLast/enqueue/enqueueFirst no longer use Type Suffixes
- Removed: Suffixes for unmodifiable & synchronize functions.
- Changed: Primitive Stacks no longer depend on the base Stack class. Because seriously not needed.
- Changed: PriorityQueues no longer extends Object Variant.
- Changed: PriorityQueues no longer extends Object Variant.
- Changed: Maps.get function is no longer using Suffixes unless its absolutely necessary.

View File

@ -14,9 +14,9 @@ But its focus is a different one.
- Iterators
# Notes about Versions
Any 0.x.0 version (Minor) can be reason for massive changes including API.
To ensure that problems can be dealt with even if it is breaking the current API.
Any breaking changes will be Documented (once 1.0 is released)
Any 0.x.0 version (Minor) can be reason for massive changes including API.
To ensure that problems can be dealt with even if it is breaking the current API.
Any breaking changes will be Documented (once 1.0 is released)
# How to install
Using Gradle:

View File

@ -230,7 +230,8 @@ public class GlobalVariables
addFunctionMappers("ENTRY_KEY", "get%sKey");
addFunctionValueMappers("ENTRY_VALUE", "get%sValue");
addFunctionMapper("GET_KEY", "get");
addFunctionValueMapper("GET_VALUE", valueType.isObject() ? "getObject" : "get");
if(type.isObject()) addFunctionValueMapper("GET_VALUE", valueType.isObject() ? "getObject" : "get");
else addSimpleMapper("GET_VALUE", "get");
addFunctionMapper("LAST_KEY", "last");
addFunctionValueMapper("MERGE", "merge");
addFunctionMapper("NEXT", "next");

View File

@ -33,7 +33,7 @@ public abstract class BaseInt2IntMapTest
Assert.assertEquals(1, putMap.put(513, 2));
Assert.assertEquals(PUT_ARRAY.length + 1, putMap.size());
Assert.assertEquals(512, putMap.addTo(0, 1));
Assert.assertEquals(513, putMap.getInt(0));
Assert.assertEquals(513, putMap.get(0));
}
@Test
@ -70,13 +70,13 @@ public abstract class BaseInt2IntMapTest
if(!getValidMapTests().contains(MapTests.REPLACE)) return;
Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY);
Assert.assertEquals(0, map.replace(0, 512));
Assert.assertEquals(512, map.getInt(0));
Assert.assertEquals(512, map.get(0));
Assert.assertTrue(map.replace(0, 512, 0));
Assert.assertFalse(map.replace(0, 512, 0));
map = createMap(TEST_ARRAY, TEST_ARRAY);
map.replaceInts((K, V) -> 99 - V);
Assert.assertEquals(99, map.getInt(0));
Assert.assertEquals(0, map.getInt(99));
Assert.assertEquals(99, map.get(0));
Assert.assertEquals(0, map.get(99));
}
@Test
@ -85,7 +85,7 @@ public abstract class BaseInt2IntMapTest
if(!getValidMapTests().contains(MapTests.COMPUTE)) return;
Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY);
Assert.assertEquals(512, map.computeInt(0, (K, V) -> 512));
Assert.assertEquals(512, map.getInt(0));
Assert.assertEquals(512, map.get(0));
Assert.assertEquals(512, map.computeIntIfAbsent(0, T -> 0));
Assert.assertEquals(0, map.computeIntIfPresent(0, (T, V) -> 0));
Assert.assertEquals(0, map.computeIntIfAbsent(-10, T -> 0));
@ -107,7 +107,7 @@ public abstract class BaseInt2IntMapTest
Int2IntMap map = createMap(TEST_ARRAY, TEST_ARRAY);
for(int i = 0;i<TEST_ARRAY.length;i++)
{
Assert.assertEquals(i, map.getInt(i));
Assert.assertEquals(i, map.get(i));
}
}