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>

public static class ExpiringHashMap.Entry<V> extends Object
A wrapper for values stored in the ExpiringHashMap that includes an expiration time.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Entry(V value)
    Creates a new Entry with the specified value and default expiration time.
    Entry(V value, long expirationTimeMs)
    Creates a new Entry with the specified value and expiration time.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
     
    long
    Returns the expiration time of this entry in milliseconds since the epoch.
    long
    Returns the time remaining until this entry expires in milliseconds.
    Returns the wrapped value.
    int
     
    boolean
    Returns true if this entry has expired.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Entry

      public Entry(V value)
      Creates a new Entry with the specified value and default expiration time.
      Parameters:
      value - the value
    • Entry

      public Entry(V value, long expirationTimeMs)
      Creates a new Entry with the specified value and expiration time.
      Parameters:
      value - the value
      expirationTimeMs - the expiration time in milliseconds from now
  • Method Details

    • getValue

      public V 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object