diff --git a/README.md b/README.md
index 53b1be99..44fc154e 100644
--- a/README.md
+++ b/README.md
@@ -6,12 +6,12 @@ java-util
Rare, hard-to-write utilities that are thoroughly tested (> 98% code coverage via JUnit tests). This library has no
-dependencies on other libraries for runtime. Built purely on JDK.
+dependencies on other libraries for runtime. Built purely on JDK. Works with JDK 1.8 through JDK 21.
To include in your project:
##### Gradle
```
-implementation 'com.cedarsoftware:java-util:2.1.1'
+implementation 'com.cedarsoftware:java-util:2.2.0'
```
##### Maven
@@ -19,22 +19,12 @@ implementation 'com.cedarsoftware:java-util:2.1.1'
com.cedarsoftwarejava-util
- 2.1.1
+ 2.2.0
```
-The java-util jar is about 150K in size.
+The java-util jar is about **150K** in size.
-### Sponsors
-[![Alt text](https://www.yourkit.com/images/yklogo.png "YourKit")](https://www.yourkit.com/.net/profiler/index.jsp)
-
-YourKit supports open source projects with its full-featured Java Profiler.
-YourKit, LLC is the creator of YourKit Java Profiler
-and YourKit .NET Profiler,
-innovative and intelligent tools for profiling Java and .NET applications.
-
-
-**Intellij IDEA**
Since Java 1.5, you can statically import classes. Using this technique with many of the classes below, it makes their methods directly accessible in your source code, keeping your source code smaller and easier to read. For example:
@@ -85,4 +75,16 @@ Included in java-util:
See [changelog.md](/changelog.md) for revision history.
+### Sponsors
+[![Alt text](https://www.yourkit.com/images/yklogo.png "YourKit")](https://www.yourkit.com/.net/profiler/index.jsp)
+
+YourKit supports open source projects with its full-featured Java Profiler.
+YourKit, LLC is the creator of YourKit Java Profiler
+and YourKit .NET Profiler,
+innovative and intelligent tools for profiling Java and .NET applications.
+
+
+**Intellij IDEA**
+
+
By: John DeRegnaucourt and Ken Partlow
diff --git a/changelog.md b/changelog.md
index af07d11c..7628b92b 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,4 +1,8 @@
### Revision History
+* 2.2.0
+ * Built with JDK 1.8 and runs with JDK 1.8 through JDK 21.
+ * The 2.2.x will continue to maintain JDK 1.8. The 3.0 branch [not yet created] will be JDK11+
+ * Added tests to verify that `GraphComparator` and `DeepEquals` do not count sorted order of Sets for equivalency. It does however, require `Collections` that are not `Sets` to be in order.
* 2.1.1
* ReflectionUtils skips static fields, speeding it up and remove runtime warning (field SerialVersionUID). Supports JDK's up through 21.
* 2.1.0
diff --git a/pom.xml b/pom.xml
index ad3a3f2d..9f21cc38 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
com.cedarsoftwarejava-utiljar
- 2.1.2-SNAPSHOT
+ 2.2.0Java Utilitieshttps://github.com/jdereg/java-util
@@ -19,15 +19,15 @@
- 11
- 11
- 11
+ 1.8
+ 1.8
+
5.10.03.24.24.14.1
- 5.2.0
+ 4.11.01.19.2
diff --git a/src/main/java/com/cedarsoftware/util/CompactMap.java b/src/main/java/com/cedarsoftware/util/CompactMap.java
index 5ac5c8ba..51f503be 100644
--- a/src/main/java/com/cedarsoftware/util/CompactMap.java
+++ b/src/main/java/com/cedarsoftware/util/CompactMap.java
@@ -609,7 +609,7 @@ public Iterator iterator()
public Set> entrySet()
{
- return new AbstractSet<>()
+ return new AbstractSet()
{
public Iterator> iterator()
{
diff --git a/src/main/java/com/cedarsoftware/util/ReflectionUtils.java b/src/main/java/com/cedarsoftware/util/ReflectionUtils.java
index 557f38ca..5e348646 100644
--- a/src/main/java/com/cedarsoftware/util/ReflectionUtils.java
+++ b/src/main/java/com/cedarsoftware/util/ReflectionUtils.java
@@ -222,7 +222,13 @@ public static void getDeclaredFields(Class> c, Collection fields) {
}
else
{
- field.trySetAccessible();
+ // JDK11+ field.trySetAccessible();
+ try
+ {
+ field.setAccessible(true);
+ }
+ catch(Exception e) { }
+ // JDK11+
fields.add(field);
}
}
diff --git a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java
index f632b698..790ebf62 100644
--- a/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java
+++ b/src/main/java/com/cedarsoftware/util/UniqueIdGenerator.java
@@ -55,16 +55,16 @@ private UniqueIdGenerator()
private static long previousTimeMilliseconds = 0;
private static long previousTimeMilliseconds2 = 0;
private static final int serverId;
- private static final Map lastIds = new LinkedHashMap<>()
+ private static final Map lastIds = new LinkedHashMap()
{
- protected boolean removeEldestEntry(Map.Entry eldest)
+ protected boolean removeEldestEntry(Map.Entry eldest)
{
return size() > 1000;
}
};
- private static final Map lastIdsFull = new LinkedHashMap<>()
+ private static final Map lastIdsFull = new LinkedHashMap()
{
- protected boolean removeEldestEntry(Map.Entry eldest)
+ protected boolean removeEldestEntry(Map.Entry eldest)
{
return size() > 10000;
}
diff --git a/src/test/java/com/cedarsoftware/util/TestCaseInsensitiveMap.java b/src/test/java/com/cedarsoftware/util/TestCaseInsensitiveMap.java
index 31112971..badcf890 100644
--- a/src/test/java/com/cedarsoftware/util/TestCaseInsensitiveMap.java
+++ b/src/test/java/com/cedarsoftware/util/TestCaseInsensitiveMap.java
@@ -1537,7 +1537,7 @@ private CaseInsensitiveMap createSimpleMap()
private Map.Entry getEntry(final String key, final Object value)
{
- return new Map.Entry<>()
+ return new Map.Entry()
{
Object myValue = value;
diff --git a/src/test/java/com/cedarsoftware/util/TestCompactMap.java b/src/test/java/com/cedarsoftware/util/TestCompactMap.java
index ef44b249..fbeea4fb 100644
--- a/src/test/java/com/cedarsoftware/util/TestCompactMap.java
+++ b/src/test/java/com/cedarsoftware/util/TestCompactMap.java
@@ -32,7 +32,7 @@ public class TestCompactMap
@Test
public void testSizeAndEmpty()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -67,7 +67,7 @@ protected Map getNewMap()
@Test
public void testSizeAndEmptyHardOrder()
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey()
{
@@ -103,7 +103,7 @@ protected Map getNewMap()
@Test
public void testContainsKey()
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey()
{
@@ -145,7 +145,7 @@ protected Map getNewMap()
@Test
public void testContainsKeyHardOrder()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -193,7 +193,7 @@ public void testContainsValue()
private void testContainsValueHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -230,7 +230,7 @@ private void testContainsValueHelper(final String singleKey)
@Test
public void testContainsValueHardOrder()
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey()
{
@@ -263,7 +263,7 @@ protected Map getNewMap()
@Test
public void testGet()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -305,7 +305,7 @@ protected Map getNewMap()
@Test
public void testGetHardOrder()
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey()
{
@@ -347,7 +347,7 @@ protected Map getNewMap()
@Test
public void testPutWithOverride()
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey()
{
@@ -370,7 +370,7 @@ protected Map getNewMap()
@Test
public void testPutWithManyEntries()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -409,7 +409,7 @@ protected Map getNewMap()
@Test
public void testPutWithManyEntriesHardOrder()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -448,7 +448,7 @@ protected Map getNewMap()
@Test
public void testPutWithManyEntriesHardOrder2()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -487,7 +487,7 @@ protected Map getNewMap()
@Test
public void testWeirdPuts()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -515,7 +515,7 @@ protected Map getNewMap()
@Test
public void testWeirdPuts1()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -549,7 +549,7 @@ public void testRemove()
private void testRemoveHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -599,7 +599,7 @@ protected Map getNewMap()
@Test
public void testPutAll()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -653,7 +653,7 @@ protected Map getNewMap()
@Test
public void testClear()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -676,7 +676,7 @@ protected Map getNewMap()
@Test
public void testKeySetEmpty()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -717,7 +717,7 @@ protected Map getNewMap()
@Test
public void testKeySet1Item()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -756,7 +756,7 @@ protected Map getNewMap()
@Test
public void testKeySet1ItemHardWay()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -796,7 +796,7 @@ protected Map getNewMap()
@Test
public void testKeySetMultiItem()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -841,7 +841,7 @@ protected Map getNewMap()
@Test
public void testKeySetMultiItem2()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey()
{
@@ -904,7 +904,7 @@ public void testKeySetMultiItemReverseRemove()
private void testKeySetMultiItemReverseRemoveHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -961,7 +961,7 @@ public void testKeySetMultiItemForwardRemove()
private void testKeySetMultiItemForwardRemoveHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1015,7 +1015,7 @@ public void testKeySetToObjectArray()
private void testKeySetToObjectArrayHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1064,7 +1064,7 @@ public void testKeySetToTypedObjectArray()
private void testKeySetToTypedObjectArrayHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1123,7 +1123,7 @@ private void testKeySetToTypedObjectArrayHelper(final String singleKey)
@Test
public void testAddToKeySet()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -1160,7 +1160,7 @@ public void testKeySetContainsAll()
private void testKeySetContainsAllHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1190,7 +1190,7 @@ public void testKeySetRetainAll()
private void testKeySetRetainAllHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1228,7 +1228,7 @@ public void testKeySetRemoveAll()
private void testKeySetRemoveAllHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1267,7 +1267,7 @@ private void testKeySetRemoveAllHelper(final String singleKey)
@Test
public void testKeySetClear()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return "field"; }
protected int compactSize() { return 3; }
@@ -1292,7 +1292,7 @@ public void testValues()
private void testValuesHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1346,7 +1346,7 @@ public void testValuesHardWay()
private void testValuesHardWayHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1413,7 +1413,7 @@ public void testValuesWith1()
private void testValuesWith1Helper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -1452,7 +1452,7 @@ private void testValuesWith1Helper(final String singleKey)
@Test
public void testValuesClear()
{
- Map map = new CompactMap<>()
+ Map map = new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -1477,7 +1477,7 @@ public void testWithMapOnRHS()
@SuppressWarnings("unchecked")
private void testWithMapOnRHSHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1538,7 +1538,7 @@ public void testWithObjectArrayOnRHS()
private void testWithObjectArrayOnRHSHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 2; }
@@ -1584,7 +1584,8 @@ private void testWithObjectArrayOnRHSHelper(final String singleKey)
@Test
public void testWithObjectArrayOnRHS1()
{
- CompactMap map = new CompactMap<>()
+
+ CompactMap map = new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 2; }
@@ -1618,7 +1619,7 @@ public void testRemove2To1WithNoMapOnRHS()
private void testRemove2To1WithNoMapOnRHSHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new LinkedHashMap<>(); }
@@ -1643,7 +1644,7 @@ public void testRemove2To1WithMapOnRHS()
@SuppressWarnings("unchecked")
private void testRemove2To1WithMapOnRHSHelper(final String singleKey)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new LinkedHashMap<>(); }
@@ -1675,7 +1676,7 @@ public void testEntrySet()
private void testEntrySetHelper(final String singleKey, final int compactSize)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new LinkedHashMap<>(); }
@@ -1743,7 +1744,7 @@ public void testEntrySetIterator()
private void testEntrySetIteratorHelper(final String singleKey, final int compactSize)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new LinkedHashMap<>(); }
@@ -1798,7 +1799,7 @@ public void testEntrySetIteratorHardWay()
private void testEntrySetIteratorHardWayHelper(final String singleKey, final int compactSize)
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return compactSize; }
@@ -1881,7 +1882,7 @@ private void testEntrySetIteratorHardWayHelper(final String singleKey, final int
@Test
public void testCompactEntry()
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -1895,7 +1896,7 @@ public void testCompactEntry()
@Test
public void testEntrySetClear()
{
- Map map = new CompactMap<>()
+ Map map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -1911,7 +1912,7 @@ public void testEntrySetClear()
@Test
public void testUsingCompactEntryWhenMapOnRHS()
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -1934,7 +1935,7 @@ public void testEntryValueOverwrite()
private void testEntryValueOverwriteHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1959,7 +1960,7 @@ public void testEntryValueOverwriteMultiple()
private void testEntryValueOverwriteMultipleHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -1996,7 +1997,7 @@ private void testEntryValueOverwriteMultipleHelper(final String singleKey)
@Test
public void testMinus()
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -2027,7 +2028,7 @@ public void testHashCodeAndEquals()
private void testHashCodeAndEqualsHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected int compactSize() { return 3; }
@@ -2066,7 +2067,7 @@ private void testHashCodeAndEqualsHelper(final String singleKey)
@Test
public void testCaseInsensitiveMap()
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected Map getNewMap() { return new CaseInsensitiveMap<>(); }
@@ -2105,7 +2106,7 @@ public void testNullHandling()
private void testNullHandlingHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected int compactSize() { return 3; }
@@ -2138,7 +2139,7 @@ public void testCaseInsensitive()
private void testCaseInsensitiveHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new CaseInsensitiveMap<>(); }
@@ -2234,7 +2235,7 @@ public void testCaseInsensitiveHardWay()
private void testCaseInsensitiveHardwayHelper(final String singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new CaseInsensitiveMap<>(); }
@@ -2321,7 +2322,7 @@ public void testCaseInsensitiveInteger()
private void testCaseInsensitiveIntegerHelper(final Integer singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected Integer getSingleValueKey() { return 16; }
protected Map getNewMap() { return new CaseInsensitiveMap<>(); }
@@ -2361,7 +2362,7 @@ public void testCaseInsensitiveIntegerHardWay()
private void testCaseInsensitiveIntegerHardWayHelper(final Integer singleKey)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected Integer getSingleValueKey() { return 16; }
protected Map getNewMap() { return new CaseInsensitiveMap<>(); }
@@ -2405,7 +2406,7 @@ public void testContains()
public void testContainsHelper(final String singleKey, final int size)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new HashMap<>(); }
@@ -2453,7 +2454,7 @@ public void testRetainOrder()
public void testRetainOrderHelper(final String singleKey, final int size)
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return singleKey; }
protected Map getNewMap() { return new TreeMap<>(); }
@@ -2495,7 +2496,7 @@ public void testRetainOrderHelper(final String singleKey, final int size)
@Test
public void testBadNoArgConstructor()
{
- CompactMap map = new CompactMap<>();
+ CompactMap map= new CompactMap();
assert "key".equals(map.getSingleValueKey());
assert map.getNewMap() instanceof HashMap;
@@ -2522,7 +2523,7 @@ public void testBadConstructor()
@Test
public void testEqualsDifferingInArrayPortion()
{
- CompactMap map = new CompactMap<>()
+ CompactMap map= new CompactMap()
{
protected String getSingleValueKey() { return "key1"; }
protected Map getNewMap() { return new HashMap<>(); }
@@ -2550,7 +2551,7 @@ public void testEqualsDifferingInArrayPortion()
@Test
public void testIntegerKeysInDefaultMap()
{
- CompactMap map = new CompactMap<>();
+ CompactMap map= new CompactMap();
map.put(6, 10);
Object key = map.getSingleValueKey();
assert key instanceof String; // "key" is the default
@@ -2700,7 +2701,7 @@ public void testCompactCILinkedMap()
@Test
public void testCaseInsensitiveEntries2()
{
- CompactMap