mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-26 19:06:24 +07:00
Fix replace with computeIfAbsent when resulting var is not used (see also IDEA-166625)
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// "Replace with 'computeIfAbsent' method call" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Test {
|
||||
interface Shift {}
|
||||
void foo(Map<String, List<Shift>> dayOfWeekAndShiftTypeToShiftListMap, String key){
|
||||
List<Shift> dayOfWeekAndShiftTypeToShiftList = dayOfWeekAndShiftTypeToShiftListMap.computeIfAbsent(key, k -> new ArrayList<>((6) / 7));
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with 'computeIfAbsent' method call" "true"
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Test {
|
||||
interface Shift {}
|
||||
void foo(Map<String, List<Shift>> dayOfWeekAndShiftTypeToShiftListMap, String key){
|
||||
List<Shift> dayOfWeekAndShiftTypeToShiftList = dayOfWeekAndShiftTypeToShiftListMap.get(key);
|
||||
if (<caret>dayOfWeekAndShiftTypeToShiftList == null) {
|
||||
dayOfWeekAndShiftTypeToShiftList = new ArrayList<>((6) / 7);
|
||||
dayOfWeekAndShiftTypeToShiftListMap.put(key, dayOfWeekAndShiftTypeToShiftList);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user