Configure hash code calculation

1 view
Skip to first unread message

Peter Fouquet

unread,
Feb 10, 2026, 2:44:15 PM (yesterday) Feb 10
to Project Lombok
Hi,
I want attributes that are not set (null values) not to be change the hashCode.
For this, I want to set the magic value in the hashCode calculation from 43 to 0, for example
result = (result*PRIME) + (this.name == null ? 0 : this.name.hashCode());

Is it possible to configure the primeForNull in HandlerUtil.java
public static int primeForNull() {
return 43;
}

Thanks for any suggestions
Peter
Reply all
Reply to author
Forward
0 new messages