Abstract Quantity
AbstractQuantity
provides additional methods to convert values directly into a target unit. They are more useful as meta-data converted to the application's internal representation (typically a double primitive type in some fixed units) before computation or further processing begin. For this purpose AbstractQuantity
provides the longValue(Unit)
and doubleValue(Unit)
convenience methods.
For example the doubleValue(Unit)
method is equivalent to the following:
With such method, user code like below are slightly easier to write:
Note that an equivalent operation can also be done using the Quantity.divide(Quantity) method.
Last updated