Package com.google.common.base
Class Internal
java.lang.Object
com.google.common.base.Internal
This class is for
com.google.common.base
use only!-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static long
toNanosSaturated
(Duration duration) Returns the number of nanoseconds of the given duration without throwing or overflowing.
-
Constructor Details
-
Internal
private Internal()
-
-
Method Details
-
toNanosSaturated
Returns the number of nanoseconds of the given duration without throwing or overflowing.Instead of throwing
ArithmeticException
, this method silently saturates to eitherLong.MAX_VALUE
orLong.MIN_VALUE
. This behavior can be useful when decomposing a duration in order to call a legacy API which requires along, TimeUnit
pair.
-