Class NumberListUtils

java.lang.Object
org.photonvision.common.util.numbers.NumberListUtils

public class NumberListUtils extends Object
  • Constructor Details

    • NumberListUtils

      public NumberListUtils()
  • Method Details

    • median

      public static <T extends Number> double median(List<T> collection, Comparator<T> comp)
      Parameters:
      collection - an ArrayList of Comparable objects
      Returns:
      the median of collection
    • toString

      public static <T extends Number> String toString(List<T> collection)
    • toString

      public static <T extends Number> String toString(List<T> collection, String suffix)
    • mean

      public static double mean(List<? extends Number> collection)
      Parameters:
      collection - an ArrayList of Numbers
      Returns:
      the mean of collection
    • nthSmallest

      public static <T> T nthSmallest(List<T> collection, int n, Comparator<T> comp)
      Parameters:
      collection - a collection of Comparable objects
      n - the position of the desired object, using the ordering defined on the collection elements
      Returns:
      the nth smallest object