I tried this: Duration.of(3, SECONDS) as per the example, but what is the SECONDS constant coming from? It's not evaluating to anything.
It's a value from the ChronoUnit
enum, implementing TemporalUnit
- your code can be written as:
Duration.of(3, ChronoUnit.SECONDS);
I'm not sure what you mean by "it's not evaluating to anything" - it's specifying what units you want to use.
Presumably you're using it without explicitly specifying ChronoUnit
due to a staic import.
Personally I'd use Duration.ofSeconds(3)
though, as I find that clearer.
See more on this question at Stackoverflow