Skip to content

Commit ea32ddb

Browse files
committed
update dictionary interfaces
1 parent 41d9dbe commit ea32ddb

7 files changed

Lines changed: 18 additions & 27 deletions

File tree

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/Dictionary.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public interface Dictionary<K, V> extends Iterable<V> {
2424

2525
Optional<V> getOptional(K key);
2626

27-
@Nullable
2827
V getOrDefault(K key, V def);
2928

3029
<C extends Collection<K>> C keys(C container);

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/IntToRefDictionary.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010

1111
public interface IntToRefDictionary<V> extends Dictionary<Integer, V> {
1212

13-
static <V> IntToRefEntry<V> entry(int key, @Nullable V value) {
13+
static <V> IntToRefEntry<V> entry(int key, V value) {
1414
return new SimpleIntToRefEntry<>(key, value);
1515
}
1616

1717
static <V> IntToRefDictionary<V> empty() {
1818
return ImmutableHashBasedIntToRefDictionary.empty();
1919
}
2020

21-
static <K, V> IntToRefDictionary<V> of(int key, @Nullable V value) {
21+
static <V> IntToRefDictionary<V> of(int key, V value) {
2222
return ofEntries(entry(key, value));
2323
}
2424

25-
static <K, V> IntToRefDictionary<V> of(int k1, @Nullable V v1, int k2, @Nullable V v2) {
25+
static <V> IntToRefDictionary<V> of(int k1, V v1, int k2, V v2) {
2626
return ofEntries(entry(k1, v1), entry(k2, v2));
2727
}
2828

2929
@SafeVarargs
30-
static <K, V> IntToRefDictionary<V> ofEntries(IntToRefEntry<V>... entries) {
30+
static <V> IntToRefDictionary<V> ofEntries(IntToRefEntry<V>... entries) {
3131
MutableIntToRefDictionary<V> mutable = DictionaryFactory.mutableIntToRefDictionary();
3232
for (var entry : entries) {
3333
mutable.put(entry.key(), entry.value());
@@ -42,7 +42,6 @@ static <K, V> IntToRefDictionary<V> ofEntries(IntToRefEntry<V>... entries) {
4242

4343
Optional<V> getOptional(int key);
4444

45-
@Nullable
4645
V getOrDefault(int key, V def);
4746

4847
MutableIntArray keys(MutableIntArray container);

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/LongToRefDictionary.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,24 +10,24 @@
1010

1111
public interface LongToRefDictionary<V> extends Dictionary<Long, V> {
1212

13-
static <V> LongToRefEntry<V> entry(long key, @Nullable V value) {
13+
static <V> LongToRefEntry<V> entry(long key, V value) {
1414
return new SimpleLongToRefEntry<>(key, value);
1515
}
1616

17-
static <K, V> LongToRefDictionary<V> empty() {
17+
static <V> LongToRefDictionary<V> empty() {
1818
return ImmutableHashBasedLongToRefDictionary.empty();
1919
}
2020

21-
static <K, V> LongToRefDictionary<V> of(long key, @Nullable V value) {
21+
static <V> LongToRefDictionary<V> of(long key, V value) {
2222
return ofEntries(entry(key, value));
2323
}
2424

25-
static <K, V> LongToRefDictionary<V> of(long k1, @Nullable V v1, long k2, @Nullable V v2) {
25+
static <V> LongToRefDictionary<V> of(long k1, V v1, long k2, V v2) {
2626
return ofEntries(entry(k1, v1), entry(k2, v2));
2727
}
2828

2929
@SafeVarargs
30-
static <K, V> LongToRefDictionary<V> ofEntries(LongToRefEntry<V>... entries) {
30+
static <V> LongToRefDictionary<V> ofEntries(LongToRefEntry<V>... entries) {
3131
MutableLongToRefDictionary<V> mutable = DictionaryFactory.mutableLongToRefDictionary();
3232
for (var entry : entries) {
3333
mutable.put(entry.key(), entry.value());
@@ -42,7 +42,6 @@ static <K, V> LongToRefDictionary<V> ofEntries(LongToRefEntry<V>... entries) {
4242

4343
Optional<V> getOptional(long key);
4444

45-
@Nullable
4645
V getOrDefault(long key, V def);
4746

4847
MutableLongArray keys(MutableLongArray container);

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/MutableIntToRefDictionary.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ static <V> MutableIntToRefDictionary<V> ofTypes(Class<V> valueType) {
1313
return new DefaultMutableHashBasedIntToRefDictionary<>();
1414
}
1515

16-
@Nullable
1716
V getOrCompute(int key, Supplier<V> factory);
1817

19-
@Nullable
2018
V getOrCompute(int key, IntFunction<V> factory);
2119

22-
@Nullable
2320
<T> V getOrCompute(int key, T arg1, Function<T, V> factory);
2421

2522
/**
2623
* @return the previous value for the key or null.
2724
*/
2825
@Nullable
29-
V put(int key, @Nullable V value);
26+
V put(int key, V value);
3027

3128
void putAll(IntToRefDictionary<? extends V> dictionary);
3229

@@ -35,7 +32,7 @@ static <V> MutableIntToRefDictionary<V> ofTypes(Class<V> valueType) {
3532
/**
3633
* @return the optional value of the previous value for the key.
3734
*/
38-
Optional<V> putOptional(int key, @Nullable V value);
35+
Optional<V> putOptional(int key, V value);
3936

4037
/**
4138
* @return the previous value for the key or null.

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/MutableLongToRefDictionary.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,17 @@ static <V> MutableLongToRefDictionary<V> ofTypes(Class<V> valueType) {
1313
return new DefaultMutableHashBasedLongToRefDictionary<>();
1414
}
1515

16-
@Nullable
1716
V getOrCompute(long key, Supplier<V> factory);
1817

19-
@Nullable
2018
V getOrCompute(long key, LongFunction<V> factory);
2119

22-
@Nullable
2320
<T> V getOrCompute(long key, T arg1, Function<T, V> factory);
2421

2522
/**
2623
* @return the previous value for the key or null.
2724
*/
2825
@Nullable
29-
V put(long key, @Nullable V value);
26+
V put(long key, V value);
3027

3128
void putAll(LongToRefDictionary<? extends V> dictionary);
3229

@@ -35,7 +32,7 @@ static <V> MutableLongToRefDictionary<V> ofTypes(Class<V> valueType) {
3532
/**
3633
* @return the optional value of the previous value for the key.
3734
*/
38-
Optional<V> putOptional(long key, @Nullable V value);
35+
Optional<V> putOptional(long key, V value);
3936

4037
/**
4138
* @return the previous value for the key or null.

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/MutableRefToRefDictionary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ static <K, V> MutableRefToRefDictionary<K, V> ofTypes(
2424
* @return the previous value for the key or null.
2525
*/
2626
@Nullable
27-
V put(K key, @Nullable V value);
27+
V put(K key, V value);
2828

2929
void putAll(RefToRefDictionary<? extends K, ? extends V> dictionary);
3030

@@ -33,7 +33,7 @@ static <K, V> MutableRefToRefDictionary<K, V> ofTypes(
3333
/**
3434
* @return the optional value of the previous value for the key.
3535
*/
36-
Optional<V> putOptional(K key, @Nullable V value);
36+
Optional<V> putOptional(K key, V value);
3737

3838
/**
3939
* @return the previous value for the key or null.

rlib-collections/src/main/java/javasabr/rlib/collections/dictionary/RefToRefDictionary.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77

88
public interface RefToRefDictionary<K, V> extends Dictionary<K, V> {
99

10-
static <K, V> RefToRefEntry<K, V> entry(K key, @Nullable V value) {
10+
static <K, V> RefToRefEntry<K, V> entry(K key, V value) {
1111
return new SimpleRefToRefEntry<>(key, value);
1212
}
1313

1414
static <K, V> RefToRefDictionary<K, V> empty() {
1515
return ImmutableHashBasedRefToRefDictionary.empty();
1616
}
1717

18-
static <K, V> RefToRefDictionary<K, V> of(K key, @Nullable V value) {
18+
static <K, V> RefToRefDictionary<K, V> of(K key, V value) {
1919
return ofEntries(entry(key, value));
2020
}
2121

22-
static <K, V> RefToRefDictionary<K, V> of(K k1, @Nullable V v1, K k2, @Nullable V v2) {
22+
static <K, V> RefToRefDictionary<K, V> of(K k1, V v1, K k2, V v2) {
2323
return ofEntries(entry(k1, v1), entry(k2, v2));
2424
}
2525

0 commit comments

Comments
 (0)