public class StandardDuration extends Object implements Duration
| Constructor and Description |
|---|
StandardDuration(long length,
TimeUnit unit) |
| Modifier and Type | Method and Description |
|---|---|
Duration |
add(Duration addend)
Returns a new duration that equals the combined length of this and the given duration in the
unit of this duration.
|
int |
compareTo(Duration o) |
boolean |
equals(Object obj) |
long |
getLength(TimeUnit target)
Returns the length of this duration in the given
TimeUnit. |
TimeUnit |
getNativeUnit()
Returns the native unit used by this duration.
|
int |
hashCode() |
boolean |
isZeroLength()
Whether this duration is of zero length.
|
Duration |
multiply(double multiplier)
Multiplies the length of this duration by the given multiplier.
|
Duration |
sub(Duration subtrahend)
Returns a new duration that equals the length of this duration minus the length of the given duration
in the unit of this duration.
|
String |
toString() |
public StandardDuration(long length,
TimeUnit unit)
public int compareTo(Duration o)
compareTo in interface Comparable<Duration>public long getLength(TimeUnit target)
DurationTimeUnit.public Duration sub(Duration subtrahend)
Durationpublic Duration add(Duration addend)
Durationpublic boolean isZeroLength()
DurationisZeroLength in interface Durationpublic TimeUnit getNativeUnit()
DurationgetNativeUnit in interface Durationpublic Duration multiply(double multiplier)
DurationCopyright © 2012–2014. All rights reserved.