Class Timing.TimedWithResult<R>

java.lang.Object
org.kiwiproject.beta.time.Timing.TimedWithResult<R>
Type Parameters:
R - the result type
All Implemented Interfaces:
Timing.Timed
Enclosing class:
Timing

public static final class Timing.TimedWithResult<R> extends Object implements Timing.Timed
Represents an operation that is timed and returns a result.
  • Constructor Details

    • TimedWithResult

      @ConstructorProperties({"elapsedMillis","result"}) public TimedWithResult(long elapsedMillis, R result)
  • Method Details

    • ofElapsedMillis

      public static <R> Timing.TimedWithResult<R> ofElapsedMillis(long elapsedMillis, R result)
      Create an instance having elapsed milliseconds and a result.
      Type Parameters:
      R - the type of result returned by the operation
      Parameters:
      elapsedMillis - the elapsed milliseconds
      result - the result of the operation
      Returns:
      a new instance
    • ofElapsedNanos

      public static <R> Timing.TimedWithResult<R> ofElapsedNanos(long elapsedNanos, R result)
      Create an instance having elapsed nanoseconds and a result.
      Type Parameters:
      R - the type of result returned by the operation
      Parameters:
      elapsedNanos - the elapsed nanoseconds
      result - the result of the operation
      Returns:
      a new instance
    • getElapsedNanos

      public long getElapsedNanos()
      Specified by:
      getElapsedNanos in interface Timing.Timed
      Returns:
      the number of nanoseconds that elapsed during the operation
    • getElapsedMillis

      public long getElapsedMillis()
      Specified by:
      getElapsedMillis in interface Timing.Timed
      Returns:
      the number of milliseconds that elapsed during the operation
    • getResult

      public R getResult()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object