Skip to content

Commit 37c3353

Browse files
committed
Allow null values in MapUtility
1 parent f5c2ec4 commit 37c3353

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/main/java/xyz/srnyx/javautilities/MapUtility.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package xyz.srnyx.javautilities;
22

33
import org.jetbrains.annotations.NotNull;
4+
import org.jetbrains.annotations.Nullable;
45

56
import java.util.HashMap;
67
import java.util.List;
@@ -42,7 +43,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull List<T> keys, @NotNull List<G> val
4243
* @param <G> the type of the value
4344
*/
4445
@NotNull
45-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value) {
46+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value) {
4647
final Map<T, G> map = new HashMap<>();
4748
map.put(key, value);
4849
return map;
@@ -62,7 +63,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value) {
6263
* @param <G> the type of the values
6364
*/
6465
@NotNull
65-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2) {
66+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2) {
6667
final Map<T, G> map = new HashMap<>();
6768
map.put(key, value);
6869
map.put(key2, value2);
@@ -85,7 +86,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
8586
* @param <G> the type of the values
8687
*/
8788
@NotNull
88-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3) {
89+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3) {
8990
final Map<T, G> map = new HashMap<>();
9091
map.put(key, value);
9192
map.put(key2, value2);
@@ -111,7 +112,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
111112
* @param <G> the type of the values
112113
*/
113114
@NotNull
114-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4) {
115+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4) {
115116
final Map<T, G> map = new HashMap<>();
116117
map.put(key, value);
117118
map.put(key2, value2);
@@ -140,7 +141,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
140141
* @param <G> the type of the values
141142
*/
142143
@NotNull
143-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4, @NotNull T key5, @NotNull G value5) {
144+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4, @NotNull T key5, @Nullable G value5) {
144145
final Map<T, G> map = new HashMap<>();
145146
map.put(key, value);
146147
map.put(key2, value2);
@@ -172,7 +173,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
172173
* @param <G> the type of the values
173174
*/
174175
@NotNull
175-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4, @NotNull T key5, @NotNull G value5, @NotNull T key6, @NotNull G value6) {
176+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4, @NotNull T key5, @Nullable G value5, @NotNull T key6, @Nullable G value6) {
176177
final Map<T, G> map = new HashMap<>();
177178
map.put(key, value);
178179
map.put(key2, value2);
@@ -207,7 +208,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
207208
* @param <G> the type of the values
208209
*/
209210
@NotNull
210-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4, @NotNull T key5, @NotNull G value5, @NotNull T key6, @NotNull G value6, @NotNull T key7, @NotNull G value7) {
211+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4, @NotNull T key5, @Nullable G value5, @NotNull T key6, @Nullable G value6, @NotNull T key7, @Nullable G value7) {
211212
final Map<T, G> map = new HashMap<>();
212213
map.put(key, value);
213214
map.put(key2, value2);
@@ -245,7 +246,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
245246
* @param <G> the type of the values
246247
*/
247248
@NotNull
248-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4, @NotNull T key5, @NotNull G value5, @NotNull T key6, @NotNull G value6, @NotNull T key7, @NotNull G value7, @NotNull T key8, @NotNull G value8) {
249+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4, @NotNull T key5, @Nullable G value5, @NotNull T key6, @Nullable G value6, @NotNull T key7, @Nullable G value7, @NotNull T key8, @Nullable G value8) {
249250
final Map<T, G> map = new HashMap<>();
250251
map.put(key, value);
251252
map.put(key2, value2);
@@ -286,7 +287,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
286287
* @param <G> the type of the values
287288
*/
288289
@NotNull
289-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4, @NotNull T key5, @NotNull G value5, @NotNull T key6, @NotNull G value6, @NotNull T key7, @NotNull G value7, @NotNull T key8, @NotNull G value8, @NotNull T key9, @NotNull G value9) {
290+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4, @NotNull T key5, @Nullable G value5, @NotNull T key6, @Nullable G value6, @NotNull T key7, @Nullable G value7, @NotNull T key8, @Nullable G value8, @NotNull T key9, @Nullable G value9) {
290291
final Map<T, G> map = new HashMap<>();
291292
map.put(key, value);
292293
map.put(key2, value2);
@@ -330,7 +331,7 @@ public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull
330331
* @param <G> the type of the values
331332
*/
332333
@NotNull
333-
public static <T, G> Map<T, G> mapOf(@NotNull T key, @NotNull G value, @NotNull T key2, @NotNull G value2, @NotNull T key3, @NotNull G value3, @NotNull T key4, @NotNull G value4, @NotNull T key5, @NotNull G value5, @NotNull T key6, @NotNull G value6, @NotNull T key7, @NotNull G value7, @NotNull T key8, @NotNull G value8, @NotNull T key9, @NotNull G value9, @NotNull T key10, @NotNull G value10) {
334+
public static <T, G> Map<T, G> mapOf(@NotNull T key, @Nullable G value, @NotNull T key2, @Nullable G value2, @NotNull T key3, @Nullable G value3, @NotNull T key4, @Nullable G value4, @NotNull T key5, @Nullable G value5, @NotNull T key6, @Nullable G value6, @NotNull T key7, @Nullable G value7, @NotNull T key8, @Nullable G value8, @NotNull T key9, @Nullable G value9, @NotNull T key10, @Nullable G value10) {
334335
final Map<T, G> map = new HashMap<>();
335336
map.put(key, value);
336337
map.put(key2, value2);

0 commit comments

Comments
 (0)