|
19 | 19 | import static com.jnape.palatable.lambda.functions.builtin.fn2.Map.map;
|
20 | 20 | import static com.jnape.palatable.lambda.lens.functions.View.view;
|
21 | 21 | import static java.util.Collections.emptyMap;
|
22 |
| -import static java.util.Collections.singletonMap; |
23 | 22 |
|
24 | 23 | /**
|
25 | 24 | * An immutable heterogeneous mapping from a parametrized type-safe key to any value, supporting a minimal mapping
|
@@ -232,6 +231,194 @@ public static <V1, V2> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1,
|
232 | 231 | public static <V1, V2, V3> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1,
|
233 | 232 | TypeSafeKey<?, V2> key2, V2 value2,
|
234 | 233 | TypeSafeKey<?, V3> key3, V3 value3) {
|
235 |
| - return hMap(key1, value1, key2, value2).put(key3, value3); |
| 234 | + return hMap(key1, value1, |
| 235 | + key2, value2) |
| 236 | + .put(key3, value3); |
236 | 237 | }
|
| 238 | + |
| 239 | + /** |
| 240 | + * Static factory method for creating an HMap from four given associations. |
| 241 | + * |
| 242 | + * @param key1 the first mapped key |
| 243 | + * @param value1 the value mapped at key1 |
| 244 | + * @param key2 the second mapped key |
| 245 | + * @param value2 the value mapped at key2 |
| 246 | + * @param key3 the third mapped key |
| 247 | + * @param value3 the value mapped at key3 |
| 248 | + * @param key4 the fourth mapped key |
| 249 | + * @param value4 the value mapped at key4 |
| 250 | + * @param <V1> value1's type |
| 251 | + * @param <V2> value2's type |
| 252 | + * @param <V3> value3's type |
| 253 | + * @param <V4> value4's type |
| 254 | + * @return an HMap with the given associations |
| 255 | + */ |
| 256 | + public static <V1, V2, V3, V4> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1, |
| 257 | + TypeSafeKey<?, V2> key2, V2 value2, |
| 258 | + TypeSafeKey<?, V3> key3, V3 value3, |
| 259 | + TypeSafeKey<?, V4> key4, V4 value4) { |
| 260 | + return hMap(key1, value1, |
| 261 | + key2, value2, |
| 262 | + key3, value3) |
| 263 | + .put(key4, value4); |
| 264 | + } |
| 265 | + |
| 266 | + /** |
| 267 | + * Static factory method for creating an HMap from five given associations. |
| 268 | + * |
| 269 | + * @param key1 the first mapped key |
| 270 | + * @param value1 the value mapped at key1 |
| 271 | + * @param key2 the second mapped key |
| 272 | + * @param value2 the value mapped at key2 |
| 273 | + * @param key3 the third mapped key |
| 274 | + * @param value3 the value mapped at key3 |
| 275 | + * @param key4 the fourth mapped key |
| 276 | + * @param value4 the value mapped at key4 |
| 277 | + * @param key5 the fifth mapped key |
| 278 | + * @param value5 the value mapped at key5 |
| 279 | + * @param <V1> value1's type |
| 280 | + * @param <V2> value2's type |
| 281 | + * @param <V3> value3's type |
| 282 | + * @param <V4> value4's type |
| 283 | + * @param <V5> value5's type |
| 284 | + * @return an HMap with the given associations |
| 285 | + */ |
| 286 | + public static <V1, V2, V3, V4, V5> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1, |
| 287 | + TypeSafeKey<?, V2> key2, V2 value2, |
| 288 | + TypeSafeKey<?, V3> key3, V3 value3, |
| 289 | + TypeSafeKey<?, V4> key4, V4 value4, |
| 290 | + TypeSafeKey<?, V5> key5, V5 value5) { |
| 291 | + return hMap(key1, value1, |
| 292 | + key2, value2, |
| 293 | + key3, value3, |
| 294 | + key4, value4) |
| 295 | + .put(key5, value5); |
| 296 | + } |
| 297 | + |
| 298 | + /** |
| 299 | + * Static factory method for creating an HMap from six given associations. |
| 300 | + * |
| 301 | + * @param key1 the first mapped key |
| 302 | + * @param value1 the value mapped at key1 |
| 303 | + * @param key2 the second mapped key |
| 304 | + * @param value2 the value mapped at key2 |
| 305 | + * @param key3 the third mapped key |
| 306 | + * @param value3 the value mapped at key3 |
| 307 | + * @param key4 the fourth mapped key |
| 308 | + * @param value4 the value mapped at key4 |
| 309 | + * @param key5 the fifth mapped key |
| 310 | + * @param value5 the value mapped at key5 |
| 311 | + * @param key6 the sixth mapped key |
| 312 | + * @param value6 the value mapped at key6 |
| 313 | + * @param <V1> value1's type |
| 314 | + * @param <V2> value2's type |
| 315 | + * @param <V3> value3's type |
| 316 | + * @param <V4> value4's type |
| 317 | + * @param <V5> value5's type |
| 318 | + * @param <V6> value6's type |
| 319 | + * @return an HMap with the given associations |
| 320 | + */ |
| 321 | + public static <V1, V2, V3, V4, V5, V6> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1, |
| 322 | + TypeSafeKey<?, V2> key2, V2 value2, |
| 323 | + TypeSafeKey<?, V3> key3, V3 value3, |
| 324 | + TypeSafeKey<?, V4> key4, V4 value4, |
| 325 | + TypeSafeKey<?, V5> key5, V5 value5, |
| 326 | + TypeSafeKey<?, V6> key6, V6 value6) { |
| 327 | + return hMap(key1, value1, |
| 328 | + key2, value2, |
| 329 | + key3, value3, |
| 330 | + key4, value4, |
| 331 | + key5, value5) |
| 332 | + .put(key6, value6); |
| 333 | + } |
| 334 | + |
| 335 | + /** |
| 336 | + * Static factory method for creating an HMap from seven given associations. |
| 337 | + * |
| 338 | + * @param key1 the first mapped key |
| 339 | + * @param value1 the value mapped at key1 |
| 340 | + * @param key2 the second mapped key |
| 341 | + * @param value2 the value mapped at key2 |
| 342 | + * @param key3 the third mapped key |
| 343 | + * @param value3 the value mapped at key3 |
| 344 | + * @param key4 the fourth mapped key |
| 345 | + * @param value4 the value mapped at key4 |
| 346 | + * @param key5 the fifth mapped key |
| 347 | + * @param value5 the value mapped at key5 |
| 348 | + * @param key6 the sixth mapped key |
| 349 | + * @param value6 the value mapped at key6 |
| 350 | + * @param key7 the seventh mapped key |
| 351 | + * @param value7 the value mapped at key7 |
| 352 | + * @param <V1> value1's type |
| 353 | + * @param <V2> value2's type |
| 354 | + * @param <V3> value3's type |
| 355 | + * @param <V4> value4's type |
| 356 | + * @param <V5> value5's type |
| 357 | + * @param <V6> value6's type |
| 358 | + * @param <V7> value7's type |
| 359 | + * @return an HMap with the given associations |
| 360 | + */ |
| 361 | + public static <V1, V2, V3, V4, V5, V6, V7> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1, |
| 362 | + TypeSafeKey<?, V2> key2, V2 value2, |
| 363 | + TypeSafeKey<?, V3> key3, V3 value3, |
| 364 | + TypeSafeKey<?, V4> key4, V4 value4, |
| 365 | + TypeSafeKey<?, V5> key5, V5 value5, |
| 366 | + TypeSafeKey<?, V6> key6, V6 value6, |
| 367 | + TypeSafeKey<?, V7> key7, V7 value7) { |
| 368 | + return hMap(key1, value1, |
| 369 | + key2, value2, |
| 370 | + key3, value3, |
| 371 | + key4, value4, |
| 372 | + key5, value5, |
| 373 | + key6, value6) |
| 374 | + .put(key7, value7); |
| 375 | + } |
| 376 | + |
| 377 | + /** |
| 378 | + * Static factory method for creating an HMap from eight given associations. |
| 379 | + * |
| 380 | + * @param key1 the first mapped key |
| 381 | + * @param value1 the value mapped at key1 |
| 382 | + * @param key2 the second mapped key |
| 383 | + * @param value2 the value mapped at key2 |
| 384 | + * @param key3 the third mapped key |
| 385 | + * @param value3 the value mapped at key3 |
| 386 | + * @param key4 the fourth mapped key |
| 387 | + * @param value4 the value mapped at key4 |
| 388 | + * @param key5 the fifth mapped key |
| 389 | + * @param value5 the value mapped at key5 |
| 390 | + * @param key6 the sixth mapped key |
| 391 | + * @param value6 the value mapped at key6 |
| 392 | + * @param key7 the seventh mapped key |
| 393 | + * @param value7 the value mapped at key7 |
| 394 | + * @param key8 the eighth mapped key |
| 395 | + * @param value8 the value mapped at key8 |
| 396 | + * @param <V1> value1's type |
| 397 | + * @param <V2> value2's type |
| 398 | + * @param <V3> value3's type |
| 399 | + * @param <V4> value4's type |
| 400 | + * @param <V5> value5's type |
| 401 | + * @param <V6> value6's type |
| 402 | + * @param <V7> value7's type |
| 403 | + * @param <V8> value8's type |
| 404 | + * @return an HMap with the given associations |
| 405 | + */ |
| 406 | + public static <V1, V2, V3, V4, V5, V6, V7, V8> HMap hMap(TypeSafeKey<?, V1> key1, V1 value1, |
| 407 | + TypeSafeKey<?, V2> key2, V2 value2, |
| 408 | + TypeSafeKey<?, V3> key3, V3 value3, |
| 409 | + TypeSafeKey<?, V4> key4, V4 value4, |
| 410 | + TypeSafeKey<?, V5> key5, V5 value5, |
| 411 | + TypeSafeKey<?, V6> key6, V6 value6, |
| 412 | + TypeSafeKey<?, V7> key7, V7 value7, |
| 413 | + TypeSafeKey<?, V8> key8, V8 value8) { |
| 414 | + return hMap(key1, value1, |
| 415 | + key2, value2, |
| 416 | + key3, value3, |
| 417 | + key4, value4, |
| 418 | + key5, value5, |
| 419 | + key6, value6, |
| 420 | + key7, value7) |
| 421 | + .put(key8, value8); |
| 422 | + } |
| 423 | + |
237 | 424 | }
|
0 commit comments