When Instant
was introduced with JSR-310, convenience methods were added to perform conversion between Date
and Instant
:
Date input = new Date();
Instant instant = input.toInstant();
Date output = Date.from(instant);
I wonder why it was chosen to be this way instead of, let's say, having Date output = instant.toDate()
. My guess is that it was intended to avoid making Instant
dependent on Date
. Is this right?
But to me it is somehow strange that you make the new class independent of the already existing one, and make the old one dependent on the newly introduce one. Is this made so because of an expected deprecation of Date
or is there any other reason?