I have the following code in my dto class.
public void setBillDate(Date billDate) { this.billDate = billDate; }
And I get an error in s
In addition to the existing answers, I propose a new version based on Optional class from Java 8.
Optional
public void setBillDate(Date billDate) { this.billDate = Optional .ofNullable(billDate) .map(Date::getTime) .map(Date::new) .orElse(null); }