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:
ChronoUnit
TemporalUnit
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.
Duration.ofSeconds(3)
The SECONDS constant, along with the other time constants, come from the ChronoUnit enum.
SECONDS
Copyright © 2021 Jogjafile Inc.
It's a value from the
ChronoUnit
enum, implementingTemporalUnit
- your code can be written as: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.