Files
2022-05-17 08:48:50 +00:00

22 lines
603 B
Java

// "Fix all 'Immutable collection creation can be replaced with collection factory call' problems in file" "true"
import java.util.*;
class Main {
void nothingInterestingHere() {
System.out.println(of(null, null));
}
public <K, V> Map<K, V> of(K k1, V v1) {
Objects.requireNonNull(k1);
Objects.requireNonNull(v1);
Map<K, V> map = new HashMap<>(1);
map.put(k1, v1);
return Collections.<caret>unmodifiableMap(map);
}
public <K, V> Map<K, V> of1(K k1, V v1) {
Map<K, V> map = new HashMap<>(1);
map.put(k1, v1);
return Collections.unmodifiableMap(map);
}
}