counter

fun counter(content: String): Map<Char, Int>

Calculate count of each value by group in the string.

Example:

val value = "aba"
counter(value) // { a = 2, b = 1 }

Since

1.1.0

See also

groupingBy
eachCount

fun <T> counter(content: Array<T>): Map<T, Int>

Calculate count of each value by group in the Array.

Example:

val value = arrayOf("a", "b", "a")
counter(value) // { a = 2, b = 1 }

Since

1.1.0

See also

groupingBy
eachCount
arrayOf

fun counter(content: ByteArray): Map<Byte, Int>

Calculate count of each value by group in the byte array.

Example:

val value = byteArrayOf(1, 2, 1)
counter(value) // { 1 = 2, 2 = 1 }

Since

1.1.0

See also

groupingBy
eachCount
byteArrayOf

fun counter(content: CharArray): Map<Char, Int>

Calculate count of each value by group in the char array.

Example:

val value = charArrayOf('a', 'b', 'a')
counter(value) // { a = 2, b = 1 }

Since

1.1.0

See also

groupingBy
eachCount
charArrayOf

fun counter(content: ShortArray): Map<Short, Int>

Calculate count of each value by group in the short array.

Example:

val value = shortArrayOf(1, 2, 1)
counter(value) // { 1 = 2, 2 = 1 }

Since

1.1.0

See also

groupingBy
eachCount
shortArrayOf

fun counter(content: IntArray): Map<Int, Int>

Calculate count of each value by group in the int array.

Example:

val value = intArrayOf(1, 2, 1)
counter(value) // { a = 2, b = 1 }

Since

1.1.0

See also

groupingBy
eachCount
intArrayOf

fun counter(content: LongArray): Map<Long, Int>

Calculate count of each value by group in the long array.

Example:

val value = longArrayOf(1L, 2L, 1L)
counter(value) // { 1L = 2, 2L = 1 }

Since

1.1.0

See also

groupingBy
eachCount
longArrayOf

fun counter(content: FloatArray): Map<Float, Int>

Calculate count of each value by group in the float array.

Example:

val value = floatArrayOf(1F, 2F, 1F)
counter(value) // { 1F = 2, 2F = 1 }

Since

1.1.0

See also

groupingBy
eachCount
floatArrayOf

fun counter(content: DoubleArray): Map<Double, Int>

Calculate count of each value by group in the double array.

Example:

val value = doubleArrayOf(1.0, 2.0, 1.0)
counter(value) // { 1.0 = 2, 2.0 = 1 }

Since

1.1.0

See also

groupingBy
eachCount
doubleArrayOf

fun counter(content: BooleanArray): Map<Boolean, Int>

Calculate count of each value by group in the boolean array.

Example:

val value = booleanArrayOf(false, true, false)
counter(value) // { false 2, true = 1 }

Since

1.1.0

See also

groupingBy
eachCount
booleanArrayOf

fun <T> counter(content: Iterable<T>): Map<T, Int>

Calculate count of each value by group in the iterable.

Example:

val value = listOf("a", "b", "a")
counter(value) // { a = 2, b = 1 }

Since

1.1.0

See also

groupingBy
eachCount
listOf