@Test public void testComprable() { Duration a = DefaultDuration.of(5, TimeUnit.MINUTES); Duration b = DefaultDuration.of(1, TimeUnit.HOURS); Duration c = DefaultDuration.of(65, TimeUnit.MINUTES); Duration d = DefaultDuration.of(2, TimeUnit.MINUTES); Duration e = DefaultDuration.of(190, TimeUnit.SECONDS); List<Duration> list = Lists.newArrayList(Arrays.asList(a, b, c, d, e)); Collections.sort(list); assertEquals(Arrays.asList(d, e, a, b, c), list); }
public static DefaultDuration of(double value, TimeUnit timeUnit) { return interner.intern(new DefaultDuration(value, timeUnit)); }
DefaultDuration implements Duration, Serializable { public static DefaultDuration of(double value, TimeUnit timeUnit) { return interner.intern(new DefaultDuration(value, timeUnit)); } }
DefaultDuration implements Duration, Serializable { public static DefaultDuration of(double value, TimeUnit timeUnit) { return interner.intern(new DefaultDuration(value, timeUnit)); } private  DefaultDuration(double value, TimeUnit timeUnit); }
DefaultDuration implements Duration, Serializable { public static DefaultDuration of(double value, TimeUnit timeUnit) { return interner.intern(new DefaultDuration(value, timeUnit)); } private  DefaultDuration(double value, TimeUnit timeUnit); static DefaultDuration of(double value, TimeUnit timeUnit); @Override TimeUnit getTimeUnit(); @Override double getValue(TimeUnit timeUnit); @Override DefaultDuration convertTo(TimeUnit targetUnit); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Duration other); @Override Duration add(Duration other); @Override Duration subtract(Duration other); @Override Duration divide(double divider); @Override Duration multiply(double multiplier); @Override String toString(); }
DefaultDuration implements Duration, Serializable { public static DefaultDuration of(double value, TimeUnit timeUnit) { return interner.intern(new DefaultDuration(value, timeUnit)); } private  DefaultDuration(double value, TimeUnit timeUnit); static DefaultDuration of(double value, TimeUnit timeUnit); @Override TimeUnit getTimeUnit(); @Override double getValue(TimeUnit timeUnit); @Override DefaultDuration convertTo(TimeUnit targetUnit); @Override int hashCode(); @Override boolean equals(Object obj); @Override int compareTo(Duration other); @Override Duration add(Duration other); @Override Duration subtract(Duration other); @Override Duration divide(double divider); @Override Duration multiply(double multiplier); @Override String toString();  }