Class ExpiringHashMap.Entry<V>
java.lang.Object
de.bsommerfeld.pathetic.engine.util.ExpiringHashMap.Entry<V>
- Type Parameters:
V- the type of the value
- Enclosing class:
- ExpiringHashMap<K,
V>
A wrapper for values stored in the ExpiringHashMap that includes an expiration time.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanlongReturns the expiration time of this entry in milliseconds since the epoch.longReturns the time remaining until this entry expires in milliseconds.getValue()Returns the wrapped value.inthashCode()booleanReturns true if this entry has expired.toString()
-
Constructor Details
-
Entry
Creates a new Entry with the specified value and default expiration time.- Parameters:
value- the value
-
Entry
Creates a new Entry with the specified value and expiration time.- Parameters:
value- the valueexpirationTimeMs- the expiration time in milliseconds from now
-
-
Method Details
-
getValue
Returns the wrapped value.- Returns:
- the value
-
getExpirationTime
public long getExpirationTime()Returns the expiration time of this entry in milliseconds since the epoch.- Returns:
- the expiration time
-
isExpired
public boolean isExpired()Returns true if this entry has expired.- Returns:
- true if this entry has expired
-
getTimeToLive
public long getTimeToLive()Returns the time remaining until this entry expires in milliseconds.- Returns:
- the time remaining in milliseconds, or 0 if the entry has expired
-
equals
-
hashCode
public int hashCode() -
toString
-