Class DurationUtils


  • public class DurationUtils
    extends Object
    Common methods for working with durations.
    Since:
    2.2.0
    Author:
    oswaldo.bapvic.jr
    • Method Detail

      • average

        public static Duration average​(Collection<Duration> durations)
        Computes and returns the mean Duration of the given collection of Durations.
        Parameters:
        durations - the collection which mean Duration is to be calculated; can be null
        Returns:
        the average of Durations in the collection; or Duration.ZERO, if the collection is either null or empty
      • min

        public static Duration min​(Collection<Duration> durations)
        Returns the lowest/minimum Duration of a given collection.
        Parameters:
        durations - the collection which the minimum element is to be calculated
        Returns:
        the lowest Duration in the collection; or Duration.ZERO, if the collection is either null or empty
      • max

        public static Duration max​(Collection<Duration> durations)
        Returns the highest/maximum Duration of a given collection.
        Parameters:
        durations - the collection which the maximum element is to be calculated
        Returns:
        the highest Duration in the collection; or Duration.ZERO, if the collection is either null or empty