diff --git a/src/main/java/com/github/tommyettinger/ds/LongFloatMap.java b/src/main/java/com/github/tommyettinger/ds/LongFloatMap.java index 810a299c..a7d65911 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongFloatMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongFloatMap.java @@ -25,6 +25,7 @@ import com.github.tommyettinger.function.LongToFloatFunction; import com.github.tommyettinger.ds.support.util.FloatIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractSet; import java.util.Arrays; @@ -824,7 +825,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(); } @@ -1138,7 +1139,7 @@ public EntryIterator (LongFloatMap map) { } @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return this; } @@ -1182,7 +1183,7 @@ public Entries (LongFloatMap 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/LongFloatOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/LongFloatOrderedMap.java index 72305664..3cc2be5f 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongFloatOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongFloatOrderedMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.ds.support.sort.LongComparators; import com.github.tommyettinger.ds.support.util.LongIterator; +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/LongIntMap.java b/src/main/java/com/github/tommyettinger/ds/LongIntMap.java index 782e996b..2fdda281 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongIntMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongIntMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.function.LongIntBiConsumer; import com.github.tommyettinger.function.LongIntToIntBiFunction; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractSet; import java.util.Arrays; @@ -781,7 +782,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 (LongIntMap map) { } @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return this; } @@ -1139,7 +1140,7 @@ public Entries (LongIntMap 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/LongIntOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/LongIntOrderedMap.java index ee632cde..da274664 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongIntOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongIntOrderedMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.ds.support.sort.LongComparators; import com.github.tommyettinger.ds.support.util.LongIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; import java.util.Map; @@ -607,7 +608,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/LongLongMap.java b/src/main/java/com/github/tommyettinger/ds/LongLongMap.java index 76eedf8d..8d96a972 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongLongMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongLongMap.java @@ -21,6 +21,7 @@ import com.github.tommyettinger.ds.support.util.LongIterator; import com.github.tommyettinger.function.LongLongBiConsumer; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractSet; import java.util.Arrays; @@ -781,7 +782,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(); } @@ -1094,7 +1095,7 @@ public EntryIterator (LongLongMap map) { } @Override - public Iterator iterator () { + public @NonNull EntryIterator iterator () { return this; } @@ -1138,7 +1139,7 @@ public Entries (LongLongMap 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/LongLongOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/LongLongOrderedMap.java index 63764933..93fe264d 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongLongOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongLongOrderedMap.java @@ -21,6 +21,7 @@ import com.github.tommyettinger.ds.support.sort.LongComparators; import com.github.tommyettinger.ds.support.util.LongIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Iterator; import java.util.Map; @@ -604,7 +605,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/LongObjectMap.java b/src/main/java/com/github/tommyettinger/ds/LongObjectMap.java index 284cb0e5..38405679 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongObjectMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongObjectMap.java @@ -23,6 +23,7 @@ import com.github.tommyettinger.function.LongObjToObjBiFunction; import com.github.tommyettinger.function.LongToObjFunction; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.AbstractCollection; import java.util.AbstractSet; @@ -782,7 +783,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(); } @@ -1100,7 +1101,7 @@ public EntryIterator (LongObjectMap map) { } @Override - public Iterator> iterator () { + public @NonNull EntryIterator iterator () { return this; } @@ -1144,7 +1145,7 @@ public Entries (LongObjectMap map) { * @return an iterator over the elements contained in this collection */ @Override - public Iterator> iterator () { + public @NonNull EntryIterator iterator () { return iter; } @@ -1253,7 +1254,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/LongObjectOrderedMap.java b/src/main/java/com/github/tommyettinger/ds/LongObjectOrderedMap.java index 097b7ce4..094469fb 100644 --- a/src/main/java/com/github/tommyettinger/ds/LongObjectOrderedMap.java +++ b/src/main/java/com/github/tommyettinger/ds/LongObjectOrderedMap.java @@ -21,6 +21,7 @@ import com.github.tommyettinger.ds.support.sort.LongComparators; import com.github.tommyettinger.ds.support.util.LongIterator; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Collection; import java.util.Comparator; @@ -587,7 +588,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/NumberedSet.java b/src/main/java/com/github/tommyettinger/ds/NumberedSet.java index b7dce095..6fd63615 100644 --- a/src/main/java/com/github/tommyettinger/ds/NumberedSet.java +++ b/src/main/java/com/github/tommyettinger/ds/NumberedSet.java @@ -17,6 +17,7 @@ package com.github.tommyettinger.ds; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Collection; import java.util.Iterator; @@ -343,7 +344,7 @@ public boolean addAll (int insertionIndex, T[] array, int offset, int count) { } @Override - public boolean retainAll (Collection c) { + public boolean retainAll (@NonNull Collection c) { boolean modified = false; Iterator it = iterator(); while (it.hasNext()) { @@ -360,7 +361,7 @@ public boolean retainAll (Collection c) { } @Override - public boolean removeAll (Collection c) { + public boolean removeAll (@NonNull Collection c) { boolean modified = false; Iterator it = iterator(); while (it.hasNext()) { @@ -518,7 +519,7 @@ public void truncate (int newSize) { * @return a ListIterator, or more specifically a {@link NumberedSetIterator} over this set */ @Override - public NumberedSetIterator iterator () { + public @NonNull NumberedSetIterator iterator () { if (iterator1 == null || iterator2 == null) { iterator1 = new NumberedSetIterator<>(this); iterator2 = new NumberedSetIterator<>(this); @@ -601,12 +602,12 @@ public void removeRange (int start, int end) { } @Override - public Object[] toArray () { + public Object @NonNull [] toArray () { return map.keySet().toArray(); } @Override - public T1[] toArray (T1[] a) { + public T1 @NonNull [] toArray (T1 @NonNull [] a) { return map.keySet().toArray(a); } @@ -902,7 +903,7 @@ public void reset (int index) { * @return a ListIterator; really this same NumberedSetIterator. */ @Override - public NumberedSetIterator iterator () { + public @NonNull NumberedSetIterator iterator () { return this; } } diff --git a/src/main/java/com/github/tommyettinger/ds/ObjectDeque.java b/src/main/java/com/github/tommyettinger/ds/ObjectDeque.java index 6a29b0ec..c9175777 100644 --- a/src/main/java/com/github/tommyettinger/ds/ObjectDeque.java +++ b/src/main/java/com/github/tommyettinger/ds/ObjectDeque.java @@ -17,6 +17,7 @@ package com.github.tommyettinger.ds; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.Arrays; import java.util.Collection; @@ -815,7 +816,7 @@ public int size () { * type} is {@code Object}, containing all of the elements in this collection */ @Override - public Object[] toArray () { + public Object @NonNull [] toArray () { Object[] next = new Object[size]; if (head < tail) { System.arraycopy(values, head, next, 0, tail - head); @@ -854,7 +855,7 @@ public Object[] toArray () { * @throws NullPointerException if the specified array is null */ @Override - public E[] toArray (E[] a) { + public E @NonNull [] toArray (E[] a) { int oldSize = size; if (a.length < oldSize) { a = Arrays.copyOf(a, oldSize); @@ -1260,7 +1261,7 @@ public void clear () { * iteration, use {@link ObjectDequeIterator#ObjectDequeIterator(ObjectDeque)}. */ @Override - public ObjectDequeIterator iterator () { + public @NonNull ObjectDequeIterator iterator () { if (iterator1 == null || iterator2 == null) { iterator1 = new ObjectDequeIterator<>(this); iterator2 = new ObjectDequeIterator<>(this); @@ -1288,7 +1289,7 @@ public ObjectDequeIterator iterator () { * @return an iterator over the elements in this deque in reverse sequence */ @Override - public ObjectDequeIterator descendingIterator () { + public @NonNull ObjectDequeIterator descendingIterator () { if (descendingIterator1 == null || descendingIterator2 == null) { descendingIterator1 = new ObjectDequeIterator<>(this, true); descendingIterator2 = new ObjectDequeIterator<>(this, true); @@ -1750,7 +1751,7 @@ public void reset (int index) { * @return a ListIterator; really this same ObjectDequeIterator. */ @Override - public ObjectDequeIterator iterator () { + public @NonNull ObjectDequeIterator iterator () { return this; } } diff --git a/src/main/java/com/github/tommyettinger/ds/ObjectList.java b/src/main/java/com/github/tommyettinger/ds/ObjectList.java index 534276c9..cf7b2ba2 100644 --- a/src/main/java/com/github/tommyettinger/ds/ObjectList.java +++ b/src/main/java/com/github/tommyettinger/ds/ObjectList.java @@ -19,6 +19,7 @@ import com.github.tommyettinger.ds.support.sort.ObjectComparators; +import org.checkerframework.checker.nullness.qual.NonNull; import org.checkerframework.checker.nullness.qual.Nullable; import java.util.ArrayList; import java.util.Collection; @@ -491,7 +492,7 @@ public StringBuilder builderAppend (StringBuilder builder, String separator) { * @throws IndexOutOfBoundsException {@inheritDoc} */ @Override - public ObjectListIterator listIterator (int index) { + public @NonNull ObjectListIterator listIterator (int index) { if (iterator1 == null || iterator2 == null) { iterator1 = new ObjectListIterator<>(this, index); iterator2 = new ObjectListIterator<>(this, index); @@ -517,7 +518,7 @@ public ObjectListIterator listIterator (int index) { * @see #listIterator(int) */ @Override - public ObjectListIterator listIterator () { + public @NonNull ObjectListIterator listIterator () { if (iterator1 == null || iterator2 == null) { iterator1 = new ObjectListIterator<>(this); iterator2 = new ObjectListIterator<>(this); @@ -543,7 +544,7 @@ public ObjectListIterator listIterator () { * @return an iterator over the elements in this list in proper sequence */ @Override - public ObjectListIterator iterator () { + public @NonNull ObjectListIterator iterator () { if (iterator1 == null || iterator2 == null) { iterator1 = new ObjectListIterator<>(this); iterator2 = new ObjectListIterator<>(this); @@ -767,7 +768,7 @@ public void reset (int index) { * @return a ListIterator; really this same ObjectListIterator. */ @Override - public ObjectListIterator iterator () { + public @NonNull ObjectListIterator iterator () { return this; } }