diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampSet.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampSet.java index 30414aaed..3831a9e0e 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampSet.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampSet.java @@ -201,6 +201,9 @@ public ChampSet add(@Nullable E element) { @Override @SuppressWarnings("unchecked") public ChampSet addAll(Iterable c) { + if(isEmpty()&&c instanceof ChampSet s){ + return (ChampSet) s; + } var m = toMutable(); return m.addAll(c) ? m.toImmutable() : this; } diff --git a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampVectorSet.java b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampVectorSet.java index c43effcb3..1491fa3f0 100644 --- a/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampVectorSet.java +++ b/org.jhotdraw8.icollection/src/main/java/org.jhotdraw8.icollection/org/jhotdraw8/icollection/ChampVectorSet.java @@ -245,6 +245,9 @@ public ChampVectorSet add(@Nullable E key) { @Override @SuppressWarnings({"unchecked"}) public ChampVectorSet addAll(Iterable c) { + if(isEmpty()&&c instanceof ChampVectorSet s){ + return (ChampVectorSet) s; + } var m = toMutable(); return m.addAll(c) ? m.toImmutable() : this; } diff --git a/pom.xml b/pom.xml index a5f7100da..3fb2b79c4 100644 --- a/pom.xml +++ b/pom.xml @@ -386,12 +386,6 @@ 1.37 test - - org.openjdk.jmh - jmh-generator-annprocess - 1.37 - test - org.jspecify