Top Description Constructors Methods
com.google.common.util.concurrent

pack-priv final Class Internal

extends Object
Class Inheritance
Annotations
@J2ktIncompatible
@GwtIncompatible
@ElementTypesAreNonnullByDefault
Imports
com.google.common.annotations.GwtIncompatible, .J2ktIncompatible, java.time.Duration

This class is for com.google.common.util.concurrent use only!

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv static long
toNanosSaturated(Duration duration)

Returns the number of nanoseconds of the given duration without throwing or overflowing.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Internalback to summary
private Internal()

Method Detail

toNanosSaturatedback to summary
pack-priv static long toNanosSaturated(Duration duration)

Returns the number of nanoseconds of the given duration without throwing or overflowing.

Instead of throwing ArithmeticException, this method silently saturates to either Long#MAX_VALUE or Long#MIN_VALUE. This behavior can be useful when decomposing a duration in order to call a legacy API which requires a long, TimeUnit pair.