From 5ee4359cc5a9a6ff1a77a5be50399bf5e6255fd2 Mon Sep 17 00:00:00 2001 From: Tommy Ettinger Date: Mon, 13 Nov 2023 19:29:42 -0800 Subject: [PATCH] That should be all the int-keyed maps... --- .../java/com/github/tommyettinger/ds/HolderSet.java | 2 +- .../java/com/github/tommyettinger/ds/IntFloatMap.java | 2 +- .../github/tommyettinger/ds/IntFloatOrderedMap.java | 3 ++- .../java/com/github/tommyettinger/ds/IntIntMap.java | 7 ++++--- .../com/github/tommyettinger/ds/IntIntOrderedMap.java | 3 ++- .../java/com/github/tommyettinger/ds/IntLongMap.java | 7 ++++--- .../github/tommyettinger/ds/IntLongOrderedMap.java | 3 ++- .../com/github/tommyettinger/ds/IntObjectMap.java | 11 ++++++----- .../github/tommyettinger/ds/IntObjectOrderedMap.java | 3 ++- 9 files changed, 24 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/github/tommyettinger/ds/HolderSet.java b/src/main/java/com/github/tommyettinger/ds/HolderSet.java index c7d65404..61f57e35 100644 --- a/src/main/java/com/github/tommyettinger/ds/HolderSet.java +++ b/src/main/java/com/github/tommyettinger/ds/HolderSet.java @@ -610,7 +610,7 @@ public void setHashMultiplier (long hashMultiplier) { } @Override - public Object[] toArray () { + public Object @NonNull [] toArray () { return toArray(new Object[size()]); } diff --git a/src/main/java/com/github/tommyettinger/ds/IntFloatMap.java b/src/main/java/com/github/tommyettinger/ds/IntFloatMap.java index da9b6deb..0687c8f2 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntFloatMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntFloatMap.java @@ -824,7 +824,7 @@ public void truncate (int newSize) { * @return an {@link Iterator} over {@link Entry} key-value pairs; remove is supported. */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } diff --git a/src/main/java/com/github/tommyettinger/ds/IntFloatOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/IntFloatOrderedMap.java index ca9e95b7..90653019 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntFloatOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntFloatOrderedMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.ds.support.sort.IntComparators; import com.github.tommyettinger.ds.support.util.IntIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; import java.util.Map; @@ -606,7 +607,7 @@ public Entries entrySet () { * @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } diff --git a/src/main/java/com/github/tommyettinger/ds/IntIntMap.java b/src/main/java/com/github/tommyettinger/ds/IntIntMap.java index e2d8953a..576b0726 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntIntMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntIntMap.java @@ -21,6 +21,7 @@ import com.github.tommyettinger.ds.support.util.IntIterator; import com.github.tommyettinger.function.IntIntBiConsumer; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractSet; import java.util.Arrays; @@ -778,7 +779,7 @@ public void truncate (int newSize) { * @return an {@link Iterator} over {@link Entry} key-value pairs; remove is supported. */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } @@ -1096,7 +1097,7 @@ public EntryIterator (IntIntMap map) { } @Override - public Iterator iterator () { + public @NonNull Iterator iterator () { return this; } @@ -1140,7 +1141,7 @@ public Entries (IntIntMap map) { * @return an iterator over the elements contained in this collection */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return iter; } diff --git a/src/main/java/com/github/tommyettinger/ds/IntIntOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/IntIntOrderedMap.java index f8841163..de8a15a3 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntIntOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntIntOrderedMap.java @@ -21,6 +21,7 @@ import com.github.tommyettinger.ds.support.sort.IntComparators; import com.github.tommyettinger.ds.support.util.IntIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; import java.util.Map; @@ -605,7 +606,7 @@ public Entries entrySet () { * @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } diff --git a/src/main/java/com/github/tommyettinger/ds/IntLongMap.java b/src/main/java/com/github/tommyettinger/ds/IntLongMap.java index 191a10f6..0e36b588 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntLongMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntLongMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.function.IntLongBiConsumer; import com.github.tommyettinger.function.IntLongToLongBiFunction; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractSet; import java.util.Arrays; @@ -780,7 +781,7 @@ public void truncate (int newSize) { * @return an {@link Iterator} over {@link Entry} key-value pairs; remove is supported. */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } @@ -1095,7 +1096,7 @@ public EntryIterator (IntLongMap map) { } @Override - public Iterator iterator () { + public @NonNull Iterator iterator () { return this; } @@ -1139,7 +1140,7 @@ public Entries (IntLongMap map) { * @return an iterator over the elements contained in this collection */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return iter; } diff --git a/src/main/java/com/github/tommyettinger/ds/IntLongOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/IntLongOrderedMap.java index 5b28b80b..56f94e21 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntLongOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntLongOrderedMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.ds.support.sort.LongComparators; import com.github.tommyettinger.ds.support.util.IntIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; import java.util.Map; @@ -606,7 +607,7 @@ public Entries entrySet () { * @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values */ @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } diff --git a/src/main/java/com/github/tommyettinger/ds/IntObjectMap.java b/src/main/java/com/github/tommyettinger/ds/IntObjectMap.java index 320ebe83..6db23919 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntObjectMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntObjectMap.java @@ -24,6 +24,7 @@ import com.github.tommyettinger.function.IntToObjFunction; import com.github.tommyettinger.function.ObjObjToObjBiFunction; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractCollection; import java.util.AbstractSet; @@ -776,7 +777,7 @@ public void truncate (int newSize) { * @return an {@link Iterator} over {@link Entry} key-value pairs; remove is supported. */ @Override - public Iterator> iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); } @@ -973,7 +974,7 @@ public void reset () { if (map.hasZeroValue) {hasNext = true;} else {findNextIndex();} } - void findNextIndex () { + protected void findNextIndex () { int[] keyTable = map.keyTable; for (int n = keyTable.length; ++nextIndex < n; ) { if (keyTable[nextIndex] != 0) { @@ -1096,7 +1097,7 @@ public EntryIterator (IntObjectMap map) { } @Override - public Iterator> iterator () { + public @NonNull EntryIterator iterator () { return this; } @@ -1140,7 +1141,7 @@ public Entries (IntObjectMap map) { * @return an iterator over the elements contained in this collection */ @Override - public Iterator> iterator () { + public @NonNull EntryIterator iterator () { return iter; } @@ -1249,7 +1250,7 @@ public void clear () { * @return an iterator over the elements contained in this collection */ @Override - public Iterator iterator () { + public @NonNull ValueIterator iterator () { return iter; } diff --git a/src/main/java/com/github/tommyettinger/ds/IntObjectOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/IntObjectOrderedMap.java index e2c3ee37..df076582 100644 --- a/src/main/java/com/github/tommyettinger/ds/IntObjectOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/IntObjectOrderedMap.java @@ -20,6 +20,7 @@ import com.github.tommyettinger.ds.support.sort.IntComparator; import com.github.tommyettinger.ds.support.util.IntIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Collection; import java.util.Comparator; @@ -586,7 +587,7 @@ public Entries entrySet () { * @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values */ @Override - public Iterator> iterator () { + public @NonNull EntryIterator iterator () { return entrySet().iterator(); }