When browsing the jsr-310 API doc, I stumbled upon the Duration class which
struck me as rather sub-optimal:
Why ist there no unit assigned to a Duration?
Why is it restricted to holding a 'seconds' value and a fractional part
expressed in 'nanoseconds'?
Why can't you add/subtract Durations with arbitrary precisions to/from each other?
Or, to sum it up: why isn't it as elegantly designed as this Duration class:
OK, I'm prejudiced because I wrote that one
But it really has some distinctive features:
- integrates seamlessly with java.util.concurrent.*
- represents a Duration as a number plus a unit plus an optional fractional part
that is Duration itself.
- allows lossless transformations between Durations with different units.