public class SimpleExpiringObject<T> extends Object implements Comparable<SimpleExpiringObject<T>>
| Constructor and Description |
|---|
SimpleExpiringObject(T value,
long expiry,
TimeUnit unit)
Creates a new object with the given value and expiring after the given time.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(SimpleExpiringObject<T> other) |
boolean |
equals(Object other) |
T |
getValue()
Returns the value of this object.
|
int |
hashCode() |
boolean |
isExpired()
Checks whether this object is expired.
|
public SimpleExpiringObject(T value, long expiry, TimeUnit unit)
IllegalArgumentException - if value is nullIllegalArgumentException - if expiry is negativeIllegalArgumentException - if unit is nullpublic int compareTo(SimpleExpiringObject<T> other)
compareTo in interface Comparable<SimpleExpiringObject<T>>public T getValue()
public boolean isExpired()