Best way to get maximum Date value in java?

前端 未结 9 1267
眼角桃花
眼角桃花 2020-12-01 13:55

I\'m writing a bit of logic that requires treating null dates as meaning forever in the future (the date in question is an expiration date, which may or may not exist). Inst

9条回答
  •  一生所求
    2020-12-01 14:02

    I like Instant.MAX because it is more likely to be supported in the future than Long.MAX_VALUE.

    Note that as of today, though, Instant.MAX.toEpochMilli() throws an overflow error.

提交回复
热议问题