Class Internal


  • @GwtIncompatible
    final class Internal
    extends java.lang.Object
    This class is for com.google.common.util.concurrent use only!
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Internal()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static long toNanosSaturated​(java.time.Duration duration)
      Returns the number of nanoseconds of the given duration without throwing or overflowing.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Internal

        private Internal()
    • Method Detail

      • toNanosSaturated

        static long toNanosSaturated​(java.time.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.