median

Returns the median of this list.

For an even number of elements, the mean of the two middle values is returned. The receiver is not modified; sorting happens on a copy in O(n log n).

Throws

if the list is empty.


@JvmName(name = "medianOfInt")
fun List<Int>.median(): Double

Returns the median of this list.

Delegates to the List of Double overload after widening each element.

Throws

if the list is empty.


@JvmName(name = "medianOfLong")
fun List<Long>.median(): Double

Returns the median of this list.

Delegates to the List of Double overload after widening each element, which loses precision above 2^53.

Throws

if the list is empty.