In Java, there are the Duration
and Period
classes for spans of time.
Is there an equivalent class for length/distance?
In Java, there are the Duration
and Period
classes for spans of time.
Is there an equivalent class for length/distance?
There are several: int
, short
, long
, float
, double
, java.util.BigInteger
... all of these would be appropriate for measuring distance. In many cases, these would also suffice for measuring time. The only reason a special class exists for measuring durations of time is that code that deals with time is often infuriatingly hard to get 100% right.