mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
ExplicitArrayFillingInspection: simplified test (IJ-CR-9863)
GitOrigin-RevId: 8a3a6eb1f8e5bbf2c73bebf2bdbfc489e7a5d136
This commit is contained in:
committed by
intellij-monorepo-bot
parent
998b2f9452
commit
493bf08f7c
+5
-26
@@ -3,35 +3,14 @@ package pack;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class HashMap<K,V> {
|
||||
static class Node<K,V> {
|
||||
final int hash;
|
||||
final K key;
|
||||
V value;
|
||||
Node<K,V> next;
|
||||
public class TableWrapper {
|
||||
|
||||
Node(int hash, K key, V value, Node<K,V> next) {
|
||||
this.hash = hash;
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
transient Node<K,V>[] table;
|
||||
|
||||
transient int size;
|
||||
|
||||
transient int modCount;
|
||||
}
|
||||
int[] table;
|
||||
|
||||
public void clear() {
|
||||
Node<K,V>[] tab;
|
||||
modCount++;
|
||||
if ((tab = table) != null && size > 0) {
|
||||
size = 0;
|
||||
Arrays.fill(tab, null);
|
||||
int[] tab;
|
||||
if ((tab = table) != null && table.length > 0) {
|
||||
Arrays.fill(tab, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
+7
-27
@@ -1,36 +1,16 @@
|
||||
// "Replace loop with 'Arrays.fill()' method call" "true"
|
||||
package pack;
|
||||
|
||||
public class HashMap<K,V> {
|
||||
static class Node<K,V> {
|
||||
final int hash;
|
||||
final K key;
|
||||
V value;
|
||||
Node<K,V> next;
|
||||
public class TableWrapper {
|
||||
|
||||
Node(int hash, K key, V value, Node<K,V> next) {
|
||||
this.hash = hash;
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.next = next;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
transient Node<K,V>[] table;
|
||||
|
||||
transient int size;
|
||||
|
||||
transient int modCount;
|
||||
}
|
||||
int[] table;
|
||||
|
||||
public void clear() {
|
||||
Node<K,V>[] tab;
|
||||
modCount++;
|
||||
if ((tab = table) != null && size > 0) {
|
||||
size = 0;
|
||||
for (<caret>int i = 0; i < tab.length; ++i)
|
||||
tab[i] = null;
|
||||
int[] tab;
|
||||
if ((tab = table) != null && table.length > 0) {
|
||||
for (int<caret> i = 0; i < tab.length; ++i) {
|
||||
tab[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user