@@ -3742,6 +3742,11 @@ public void forEach(long parallelismThreshold,
3742
3742
* @param <U> the return type of the transformer
3743
3743
* @since 1.8
3744
3744
*/
3745
+ // JSpecify: We could instead use `<U extends @Nullable Object>` along with `@NonNull U`.
3746
+ // Advantages to our current approach include:
3747
+ // - calls out the null support in an otherwise null-hostile class
3748
+ // - is consistent with the declarations for `search` and `reduce`
3749
+ // - saves the user from a decision: https://github.com/jspecify/jspecify/issues/525
3745
3750
public <U > void forEach (long parallelismThreshold ,
3746
3751
BiFunction <? super K , ? super V , ? extends @ Nullable U > transformer ,
3747
3752
Consumer <? super U > action ) {
@@ -3909,6 +3914,7 @@ public void forEachKey(long parallelismThreshold,
3909
3914
* @param <U> the return type of the transformer
3910
3915
* @since 1.8
3911
3916
*/
3917
+ // JSpecify: See discussion on `forEach` above.
3912
3918
public <U > void forEachKey (long parallelismThreshold ,
3913
3919
Function <? super K , ? extends @ Nullable U > transformer ,
3914
3920
Consumer <? super U > action ) {
@@ -4096,6 +4102,7 @@ public void forEachValue(long parallelismThreshold,
4096
4102
* @param <U> the return type of the transformer
4097
4103
* @since 1.8
4098
4104
*/
4105
+ // JSpecify: See discussion on `forEach` above.
4099
4106
public <U > void forEachValue (long parallelismThreshold ,
4100
4107
Function <? super V , ? extends @ Nullable U > transformer ,
4101
4108
Consumer <? super U > action ) {
@@ -4280,6 +4287,7 @@ public void forEachEntry(long parallelismThreshold,
4280
4287
* @param <U> the return type of the transformer
4281
4288
* @since 1.8
4282
4289
*/
4290
+ // JSpecify: See discussion on `forEach` above.
4283
4291
public <U > void forEachEntry (long parallelismThreshold ,
4284
4292
Function <Map .Entry <K ,V >, ? extends @ Nullable U > transformer ,
4285
4293
Consumer <? super U > action ) {
0 commit comments