mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 02:09:59 +07:00
Java: use deepEquals() / deepHashCode() for multi-dimensional arrays (IDEA-199543)
when generating equals() and hashCode() methods using the "java.util.Objects.equals() and hash() (java 7+)" template GitOrigin-RevId: a863b875fa482542bbb9b2efc5e61cfa2bfb787d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f8773787b2
commit
caab7e4bf9
@@ -1,4 +1,5 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
class I {
|
||||
public int hashCode() {
|
||||
@@ -18,13 +19,11 @@ class A extends I {
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
if (!super.equals(o)) return false;
|
||||
final A a = (A) o;
|
||||
return Arrays.equals(a1, a.a1);
|
||||
return Objects.deepEquals(a1, a.a1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = super.hashCode();
|
||||
result = 31 * result + Arrays.hashCode(a1);
|
||||
return result;
|
||||
return Objects.hash(super.hashCode(), Arrays.hashCode(a1));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user