Comment

Comment by adrianmsmith

Before Java 8 and Jodatime, it was better to use java.util.Date than a long, for type-checking and self-documentation.

If a function accepts a java.util.Date and you pass an id of some database object by mistake, you'll get a compile error. If the function accepts a long you won't.

If a function accepts a java.util.Date and the parameter is called "start" you know it accepts an instant in time, if it accepts a long you might think it could be something else.

Yes, the class is terribly named, but before there was Java 8 and Jodatime, it was better to use it than a long.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton