Skip to content

Commit

Permalink
That should be all the int-keyed maps...
Browse files Browse the repository at this point in the history
  • Loading branch information
tommyettinger committed Nov 14, 2023
1 parent 9868774 commit 5ee4359
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/main/java/com/github/tommyettinger/ds/HolderSet.java
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ public void setHashMultiplier (long hashMultiplier) {
}

@Override
public Object[] toArray () {
public Object @NonNull [] toArray () {
return toArray(new Object[size()]);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/github/tommyettinger/ds/IntFloatMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return entrySet().iterator();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -606,7 +607,7 @@ public Entries entrySet () {
* @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values
*/
@Override
public Iterator<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return entrySet().iterator();
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/github/tommyettinger/ds/IntIntMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return entrySet().iterator();
}

Expand Down Expand Up @@ -1096,7 +1097,7 @@ public EntryIterator (IntIntMap map) {
}

@Override
public Iterator<Entry> iterator () {
public @NonNull Iterator<Entry> iterator () {
return this;
}

Expand Down Expand Up @@ -1140,7 +1141,7 @@ public Entries (IntIntMap map) {
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return iter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -605,7 +606,7 @@ public Entries entrySet () {
* @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values
*/
@Override
public Iterator<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return entrySet().iterator();
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/com/github/tommyettinger/ds/IntLongMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return entrySet().iterator();
}

Expand Down Expand Up @@ -1095,7 +1096,7 @@ public EntryIterator (IntLongMap map) {
}

@Override
public Iterator<Entry> iterator () {
public @NonNull Iterator<Entry> iterator () {
return this;
}

Expand Down Expand Up @@ -1139,7 +1140,7 @@ public Entries (IntLongMap map) {
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return iter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -606,7 +607,7 @@ public Entries entrySet () {
* @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values
*/
@Override
public Iterator<Entry> iterator () {
public @NonNull EntryIterator iterator () {
return entrySet().iterator();
}

Expand Down
11 changes: 6 additions & 5 deletions src/main/java/com/github/tommyettinger/ds/IntObjectMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Entry<V>> iterator () {
public @NonNull EntryIterator<V> iterator () {
return entrySet().iterator();
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -1096,7 +1097,7 @@ public EntryIterator (IntObjectMap<V> map) {
}

@Override
public Iterator<Entry<V>> iterator () {
public @NonNull EntryIterator<V> iterator () {
return this;
}

Expand Down Expand Up @@ -1140,7 +1141,7 @@ public Entries (IntObjectMap<V> map) {
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<Entry<V>> iterator () {
public @NonNull EntryIterator<V> iterator () {
return iter;
}

Expand Down Expand Up @@ -1249,7 +1250,7 @@ public void clear () {
* @return an iterator over the elements contained in this collection
*/
@Override
public Iterator<V> iterator () {
public @NonNull ValueIterator<V> iterator () {
return iter;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -586,7 +587,7 @@ public Entries<V> entrySet () {
* @return an {@link Iterator} over key-value pairs as {@link Map.Entry} values
*/
@Override
public Iterator<Entry<V>> iterator () {
public @NonNull EntryIterator<V> iterator () {
return entrySet().iterator();
}

Expand Down

0 comments on commit 5ee4359

Please sign in to comment.