groupBy

inline fun <K> ByteBuffer.groupBy(keySelector: (Byte) -> K): Map<K, List<Byte>>
inline fun <K> ShortBuffer.groupBy(keySelector: (Short) -> K): Map<K, List<Short>>
inline fun <K> IntBuffer.groupBy(keySelector: (Int) -> K): Map<K, List<Int>>
inline fun <K> LongBuffer.groupBy(keySelector: (Long) -> K): Map<K, List<Long>>
inline fun <K> FloatBuffer.groupBy(keySelector: (Float) -> K): Map<K, List<Float>>
inline fun <K> DoubleBuffer.groupBy(keySelector: (Double) -> K): Map<K, List<Double>>
inline fun <K> CharBuffer.groupBy(keySelector: (Char) -> K): Map<K, List<Char>>

Groups elements of the original array by the key returned by the given keySelector function applied to each element and returns a map where each group key is associated with a list of corresponding elements.

The returned map preserves the entry iteration order of the keys produced from the original array.

Samples

kool.buffers.Collections.Transformations.groupBy
inline fun <K, V> ByteBuffer.groupBy(keySelector: (Byte) -> K, valueTransform: (Byte) -> V): Map<K, List<V>>
inline fun <K, V> ShortBuffer.groupBy(keySelector: (Short) -> K, valueTransform: (Short) -> V): Map<K, List<V>>
inline fun <K, V> IntBuffer.groupBy(keySelector: (Int) -> K, valueTransform: (Int) -> V): Map<K, List<V>>
inline fun <K, V> LongBuffer.groupBy(keySelector: (Long) -> K, valueTransform: (Long) -> V): Map<K, List<V>>
inline fun <K, V> FloatBuffer.groupBy(keySelector: (Float) -> K, valueTransform: (Float) -> V): Map<K, List<V>>
inline fun <K, V> DoubleBuffer.groupBy(keySelector: (Double) -> K, valueTransform: (Double) -> V): Map<K, List<V>>
inline fun <K, V> CharBuffer.groupBy(keySelector: (Char) -> K, valueTransform: (Char) -> V): Map<K, List<V>>

Groups values returned by the valueTransform function applied to each element of the original array by the key returned by the given keySelector function applied to the element and returns a map where each group key is associated with a list of corresponding values.

The returned map preserves the entry iteration order of the keys produced from the original array.

Samples

kool.buffers.Collections.Transformations.groupByKeysAndValues