Class StopWatch


  • public class StopWatch
    extends Object
    Stop watch feature that allows you to time operations
    • Constructor Detail

      • StopWatch

        public StopWatch()
    • Method Detail

      • time

        public static Duration time​(Runnable operation)
        Time how long it takes to perform an operation
        Parameters:
        operation - the operation to perform
        Returns:
        the time it took to perform the operation as a Duration
      • time

        public static <R> TimingResult<R> time​(Supplier<R> operation)
        Time how long it takes to perform an operation
        Type Parameters:
        R - The return type of the operation
        Parameters:
        operation - the operation to perform
        Returns:
        the timing result (the result together with the time it took to perform the operation as a Duration)