convertTo method
Returns a new Quantity converted to another unit.
Implementation
Quantity<K> convertTo(Unit<K> anotherUnit) {
double converted;
if (anotherUnit == unit) {
converted = amount;
} else {
converted = unit.quantityConverterTo(anotherUnit)(amount);
}
return Quantity<K>(unit: anotherUnit, amount: converted);
}