# Class Duration

java.lang.Object
java.time.Duration

All Implemented Interfaces:
  `Comparable<Duration>`

public final class Duration extends java.lang.Object implements Comparable<Duration>

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `compareTo(Duration other)`
  Compares this object to the specified object to determine their relative order.
  `boolean`
  `equals(java.lang.Object obj)`
  `int`
  `getNano()`
  `long`
  `getSeconds()`
  `int`
  `hashCode()`
  `Duration`
  `minus(Duration other)`
  `static Duration`
  `ofDays(long days)`
  `static Duration`
  `ofHours(long hours)`
  `static Duration`
  `ofMillis(long millis)`
  `static Duration`
  `ofMinutes(long minutes)`
  `static Duration`
  `ofSeconds(long seconds)`
  `static Duration`
  `ofSeconds(long seconds, long nanoAdjustment)`
  `Duration`
  `plus(Duration other)`
  `long`
  `toMillis()`
  `String`
  `toString()`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Method Details

  - ### ofDays

    public static Duration ofDays(long days)

  - ### ofHours

    public static Duration ofHours(long hours)

  - ### ofMinutes

    public static Duration ofMinutes(long minutes)

  - ### ofSeconds

    public static Duration ofSeconds(long seconds)

  - ### ofSeconds

    public static Duration ofSeconds(long seconds, long nanoAdjustment)

  - ### ofMillis

    public static Duration ofMillis(long millis)

  - ### getSeconds

    public long getSeconds()

  - ### getNano

    public int getNano()

  - ### toMillis

    public long toMillis()

  - ### plus

    public Duration plus(Duration other)

  - ### minus

    public Duration minus(Duration other)

  - ### compareTo

    public int compareTo(Duration other)
    Description copied from interface: `Comparable`

    Compares this object to the specified object to determine their relative order.

    ###### Parameters

    - `another`: the object to compare to this instance.

    ###### Returns

    Specified by:
      `compareTo` in interface `Comparable<Duration>`
    Returns:

      a negative integer if this instance is less than `another`; a positive integer if this instance is greater than `another`; 0 if this instance has the same order as `another`.

      ###### Throws

      - `ClassCastException`: @throws ClassCastException if `another` cannot be converted into something comparable to `this` instance.

  - ### equals

    public boolean equals(java.lang.Object obj)
    Overrides:
      `equals` in class `java.lang.Object`

  - ### hashCode

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

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `java.lang.Object`