Configuration of hashCode calculation for attributes

1 view
Skip to first unread message

Peter Fouquet

unread,
Feb 10, 2026, 2:44:37 PM (yesterday) Feb 10
to Project Lombok
Hi,
it is possible to configure the hashCode calculation in Lombok?
I want attributes that are not set (null values) not 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());

It is possible to set the value in HandlerUtil to 0?
public static int primeForNull() {
  return 43;
}

Kind regards for suggestions
Peter
Reply all
Reply to author
Forward
0 new messages