mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 04:16:19 +00:00
The hashCode() method now generates a magic prime instead of 0 for the hash of null values; this reduces collisions.
This commit is contained in:
1 parent
23dcc9f5a5
commit
251fd03cd7
25 files changed
+49
-44
No files matched your search
@@ -40,7 +40,7 @@ class DataOnLocalClass1 {
|
||||
int result = 1;
|
||||
result = ((result * PRIME) + this.getX());
|
||||
final java.lang.Object $name = this.getName();
|
||||
result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode()));
|
||||
result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode()));
|
||||
return result;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
|
||||
@@ -89,7 +89,7 @@ class DataOnLocalClass2 {
|
||||
final int PRIME = 59;
|
||||
int result = 1;
|
||||
final java.lang.Object $name = this.getName();
|
||||
result = ((result * PRIME) + (($name == null) ? 0 : $name.hashCode()));
|
||||
result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode()));
|
||||
return result;
|
||||
}
|
||||
public @java.lang.Override @java.lang.SuppressWarnings("all") @javax.annotation.Generated("lombok") java.lang.String toString() {
|
||||
|
||||
Reference in new issue
Block a user