mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
RedundantCollectionOperation: warn on if(map.containsKey(x)) map.remove(x)
Review ID: IDEA-CR-28150
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// "Remove the 'containsKey' check" "true"
|
||||
import java.util.Map;
|
||||
|
||||
class Test {
|
||||
void test(Map<String, Integer> map, String key) {
|
||||
/*contains!!!*/
|
||||
map.remove(/*remove!!!*/key);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Remove the 'containsKey' check" "true"
|
||||
import java.util.Map;
|
||||
|
||||
class Test {
|
||||
void test(Map<String, Integer> map, String key) {
|
||||
if(map.co<caret>ntainsKey(/*contains!!!*/key)) {
|
||||
map.remove(/*remove!!!*/key);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user