25
25
26
26
package java .util ;
27
27
28
+ import org .jspecify .annotations .NonNull ;
28
29
import org .jspecify .annotations .NullMarked ;
29
30
import org .jspecify .annotations .Nullable ;
30
31
@@ -581,7 +582,7 @@ final Entry<K,V> getLowerEntry(K key) {
581
582
}
582
583
583
584
@ Override
584
- public V putIfAbsent (K key , V value ) {
585
+ public @ Nullable V putIfAbsent (K key , V value ) {
585
586
return put (key , value , false );
586
587
}
587
588
@@ -666,7 +667,7 @@ else if (cmp > 0)
666
667
* remapping function modified this map
667
668
*/
668
669
@ Override
669
- public V computeIfPresent (K key , BiFunction <? super K , ? super V , ? extends V > remappingFunction ) {
670
+ public @ Nullable V computeIfPresent (K key , BiFunction <? super K , ? super @ NonNull V , ? extends @ Nullable V > remappingFunction ) {
670
671
Objects .requireNonNull (remappingFunction );
671
672
Entry <K ,V > oldEntry = getEntry (key );
672
673
if (oldEntry != null && oldEntry .value != null ) {
@@ -687,7 +688,7 @@ public V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> r
687
688
* remapping function modified this map
688
689
*/
689
690
@ Override
690
- public V compute (K key , BiFunction <? super K , ? super V , ? extends V > remappingFunction ) {
691
+ public @ Nullable V compute (K key , BiFunction <? super K , ? super @ Nullable V , ? extends @ Nullable V > remappingFunction ) {
691
692
Objects .requireNonNull (remappingFunction );
692
693
V newValue ;
693
694
Entry <K ,V > t = root ;
@@ -749,7 +750,7 @@ else if (cmp > 0)
749
750
* remapping function modified this map
750
751
*/
751
752
@ Override
752
- public V merge (K key , V value , BiFunction <? super V , ? super V , ? extends V > remappingFunction ) {
753
+ public @ Nullable V merge (K key , @ NonNull V value , BiFunction <? super @ NonNull V , ? super @ NonNull V , ? extends @ Nullable V > remappingFunction ) {
753
754
Objects .requireNonNull (remappingFunction );
754
755
Objects .requireNonNull (value );
755
756
Entry <K ,V > t = root ;
0 commit comments