相当于Java 8 Date和Time API中的jodatime Interval [英] Equivalent to jodatime Interval in Java 8 Date and Time API
问题描述
Java 8处理时间的方式似乎已经有了很大改进,我开始考虑更换 jodatime 在某些情况下。但我缺少的是与 Interval 类相同的内容。
The Java 8 way of dealing with time seems to have improved so much that I start to think about replacing jodatime in some cases. But what I am missing is an equivalent to the Interval class.
我还没有深入挖掘Java 8,所以我可能错过了那些东西。有没有人有关于如何最好地处理间隔的想法?
I haven't dug too deep into Java 8 yet, so I might have missed something there. Does anyone have ideas on how intervals could be best dealt with?
推荐答案
没办法,Joda类 JSR-310中不存在Interval
。 持续时间
,期间
等的概念表示时间量,而不受固定时间点的约束,而间隔有时间线上的固定开始和固定结束。
No way, the Joda class Interval
does not exist in JSR-310. The concepts of Duration
, Period
etc. denotes temporal amounts without being bound to fixed points in time while an interval has a fixed start and fixed end on the timeline.
顺便说一句,这个问题不是新问题,而且重复。在另一个SO链接上,您也可以直接从JodaTime项目负责人那里找到类似的答案。
By the way, this question is not new and a duplicate. On the other SO-link you can also find a similar answer direct from JodaTime-project-leader.
这篇关于相当于Java 8 Date和Time API中的jodatime Interval的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!