Class Duration

  • All Implemented Interfaces:
    java.io.Serializable

    public final class Duration
    extends java.lang.Object
    implements java.io.Serializable
    Immutable representation of a duration.
    Author:
    Evren Sirin
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      Duration​(long time)  
      Duration​(long time, java.util.concurrent.TimeUnit theUnit)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)
      long getMillis()  
      int hashCode()
      java.lang.String toString()
      String representation of duration
      long toUnit​(java.util.concurrent.TimeUnit theUnit)  
      static Duration valueOf​(java.lang.String str)
      Creates a duration instance from the string.
      • Methods inherited from class java.lang.Object

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

      • Duration

        public Duration​(long time)
      • Duration

        public Duration​(long time,
                        java.util.concurrent.TimeUnit theUnit)
    • Method Detail

      • getMillis

        public long getMillis()
      • toUnit

        public long toUnit​(java.util.concurrent.TimeUnit theUnit)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • toString

        public java.lang.String toString()
        String representation of duration
        Overrides:
        toString in class java.lang.Object
      • valueOf

        public static Duration valueOf​(java.lang.String str)
        Creates a duration instance from the string.