Class Internal

java.lang.Object
com.google.common.base.Internal

final class Internal extends Object
This class is for com.google.common.base use only!
  • Constructor Details

    • Internal

      private Internal()
  • Method Details

    • toNanosSaturated

      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.