-
- 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 that returns a time value representing the number of nanoseconds elapsed since some fixed but arbitrary point in time.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static Ticker
disabledTicker()
Returns a ticker that always returns0
.long
read()
Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.static Ticker
systemTicker()
Returns a ticker that reads the current time usingSystem.nanoTime()
.
-
-
-
Method Detail
-
read
long read()
Returns the number of nanoseconds elapsed since this ticker's fixed point of reference.- Returns:
- the number of nanoseconds elapsed since this ticker's fixed point of reference
-
systemTicker
static Ticker systemTicker()
Returns a ticker that reads the current time usingSystem.nanoTime()
.- Returns:
- a ticker that reads the current time using
System.nanoTime()
-
disabledTicker
static Ticker disabledTicker()
Returns a ticker that always returns0
.- Returns:
- a ticker that always returns
0
-
-