Interface Ticker

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface Ticker
A time source; returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.

Warning: this interface can only be used to measure elapsed time, not wall time.

  • Method Summary

    Modifier and Type Method Description
    long read()
    Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.
    static Ticker systemTicker()
    A ticker that reads the current time using System.nanoTime().
  • Method Details

    • read

      long read()
      Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.
    • systemTicker

      static Ticker systemTicker()
      A ticker that reads the current time using System.nanoTime().