@Test public void testAbs() { assertEquals(DefaultDistance.of(5, DistanceUnit.METERS), Distances.abs(DefaultDistance.of(5, DistanceUnit.METERS))); assertEquals(DefaultDistance.of(5, DistanceUnit.METERS), Distances.abs(DefaultDistance.of(-5, DistanceUnit.METERS))); }
public static Distance abs(Distance distance) { return distance.compareTo(ZERO) >= 0 ? distance : reverse(distance); }
Distances { public static Distance abs(Distance distance) { return distance.compareTo(ZERO) >= 0 ? distance : reverse(distance); } }
Distances { public static Distance abs(Distance distance) { return distance.compareTo(ZERO) >= 0 ? distance : reverse(distance); } private  Distances(); }
Distances { public static Distance abs(Distance distance) { return distance.compareTo(ZERO) >= 0 ? distance : reverse(distance); } private  Distances(); static Iterable<Distance> getDefaultDistances(); static Iterable<Distance> distanceIterator(Distance upto); static Distance abs(Distance distance); static Distance reverse(Distance distance); }
Distances { public static Distance abs(Distance distance) { return distance.compareTo(ZERO) >= 0 ? distance : reverse(distance); } private  Distances(); static Iterable<Distance> getDefaultDistances(); static Iterable<Distance> distanceIterator(Distance upto); static Distance abs(Distance distance); static Distance reverse(Distance distance);  }