sortedWith

fun ByteBuffer.sortedWith(comparator: Comparator<in Byte>): List<Byte>
fun ShortBuffer.sortedWith(comparator: Comparator<in Short>): List<Short>
fun IntBuffer.sortedWith(comparator: Comparator<in Int>): List<Int>
fun LongBuffer.sortedWith(comparator: Comparator<in Long>): List<Long>
fun FloatBuffer.sortedWith(comparator: Comparator<in Float>): List<Float>
fun DoubleBuffer.sortedWith(comparator: Comparator<in Double>): List<Double>
fun CharBuffer.sortedWith(comparator: Comparator<in Char>): List<Char>

Returns a list of all elements sorted according to the specified comparator.