mode

inline fun <T> Array<T>.mode(): List<T>

Computes the mode of the value Array.

Notice -> If all element repetition is equals all of them return as mode.

Example:

arrayOf(1, 1, 1, 2, 3, 4, 5, 5, 2).mode() // [1]
arrayOf(1, 2, 3, 4, 5, 6, 7).mode() // [1, 2, 3, 4, 5, 6, 7]

Since

1.1.0


inline fun <T> Iterable<T>.mode(): List<T>

Computes the mode of the value Iterable.

Notice -> If all element repetition is equals all of them return as mode.

Example:

listOf(1, 1, 1, 2, 3, 4, 5, 5, 2).mode() // [1]
listOf(1, 2, 3, 4, 5, 6, 7).mode() // [1, 2, 3, 4, 5, 6, 7]

Since

1.1.0