-
Type:
Enhancement
-
Resolution: Unresolved
-
Priority:
P4
-
Affects Version/s: 18
-
Component/s: core-libs
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
Apologies if this discussion has already occurred. I think Map1() and particularly MapN() in ImmutableCollections.java should return more contextual information if a value is null. Changing the lines to something like
K k = Objects.requireNonNull((K)input[i], () -> "Key for map entry " + i + " was null");
and
V v = Objects.requireNonNull((V)input[i+1], () -> "Value for map entry " + i + " was null");
could prevent some heartache, and these are already more or less off the happy path, so the performance impact should be minimal.
Apologies if this discussion has already occurred. I think Map1() and particularly MapN() in ImmutableCollections.java should return more contextual information if a value is null. Changing the lines to something like
K k = Objects.requireNonNull((K)input[i], () -> "Key for map entry " + i + " was null");
and
V v = Objects.requireNonNull((V)input[i+1], () -> "Value for map entry " + i + " was null");
could prevent some heartache, and these are already more or less off the happy path, so the performance impact should be minimal.