Class NumberListUtils
java.lang.Object
org.photonvision.common.util.numbers.NumberListUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic double
static <T extends Number>
doublemedian
(List<T> collection, Comparator<T> comp) static <T> T
nthSmallest
(List<T> collection, int n, Comparator<T> comp)
-
Constructor Details
-
NumberListUtils
public NumberListUtils()
-
-
Method Details
-
median
- Parameters:
collection
- an ArrayList of Comparable objects- Returns:
- the median of collection
-
toString
-
toString
-
mean
- Parameters:
collection
- an ArrayList of Numbers- Returns:
- the mean of collection
-
nthSmallest
- Parameters:
collection
- a collection of Comparable objectsn
- the position of the desired object, using the ordering defined on the collection elements- Returns:
- the nth smallest object
-