public final class Duration
extends java.lang.Object
TimeUnit| Modifier and Type | Field and Description |
|---|---|
static Duration |
FOREVER
Special Duration value that indicates an infinite amount of time.
|
static Duration |
ZERO
Special Duration value to represent a zero length duration
|
| Constructor and Description |
|---|
Duration(long amount,
java.util.concurrent.TimeUnit timeUnit)
Construct a
Duration instance |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
long |
getAmount()
Get the amount of
getTimeUnit() this instance represents |
java.util.concurrent.TimeUnit |
getTimeUnit()
Get the
TimeUnit of this instance |
int |
hashCode() |
boolean |
isForever()
Is this duration "forever" / infinite
|
java.lang.String |
toString() |
public static final Duration FOREVER
public static final Duration ZERO
public Duration(long amount,
java.util.concurrent.TimeUnit timeUnit)
Duration instanceamount - the amount of the given time unittimeUnit - the time unitjava.lang.IllegalArgumentException - if the given amount is less than zerojava.lang.NullPointerException - if the given time unit is nullpublic long getAmount()
getTimeUnit() this instance representsjava.lang.IllegalStateException - if this instance is FOREVERpublic java.util.concurrent.TimeUnit getTimeUnit()
TimeUnit of this instanceTimeUnit of this instancejava.lang.IllegalStateException - if this instance is FOREVERpublic boolean isForever()
FOREVERpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object