Why does the Duration class not have 'toSeconds()' method?
问题 I was looking at the Duration class in Java 8 and noticed that it does not have: long toSeconds(); But it has all other toXXXXX() to get days, hours, minutes, millis, nanos. I do see a getSeconds() method that returns the number of seconds within this duration object. There is also a get(TemporalUnit unit) method to get the duration as the requested time unit. But why not keep the toSeconds() method for consistency? 回答1: Let's look at what the docs say: This class models a quantity or amount