الفرق بين المراجعتين ل"Kotlin/collections/sortDescending"

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
ط (استبدال النص - 'Kotlin Functions' ب'Kotlin Function')
سطر 37: سطر 37:
 
*[https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sort-descending.html صفحة الدالة sortDescending()‎ في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.]
 
*[https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/sort-descending.html صفحة الدالة sortDescending()‎ في التوثيق الرسميّ للمكتبة القياسيّة في لغة Kotlin.]
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin]]
[[تصنيف:Kotlin Functions]]
+
[[تصنيف:Kotlin Function]]

مراجعة 11:37، 30 أغسطس 2018

ترتِّب الدالة sortDescending()‎ المصفوفة أو القائمة المتغيرة (MutableList) التي استُدعيت معها تنازليًّا. 

البنية العامة

يمكن استدعاء الدالة sortDescending()‎ مع المصفوفات والقوائم المتغيرة

fun <T : Comparable<T>> Array<out T>.sortDescending() 
fun ByteArray.sortDescending() 
fun ShortArray.sortDescending() 
fun IntArray.sortDescending() 
fun LongArray.sortDescending() 
fun FloatArray.sortDescending() 
fun DoubleArray.sortDescending() 
fun CharArray.sortDescending() 

fun <T : Comparable<T>> MutableList<T>.sortDescending()

أمثلة

استعمال الدالة ()sortDescending لترتيب عناصر مصفوفة تنازليًّا:

import java.util.Arrays

fun main(args: Array<String>) {
    val array = arrayOf(1, 9, -3, 7, 5, 6)
    array.sortDescending()

    print(Arrays.toString(array)) // [9, 7, 6, 5, 1, -3]
}

انظر أيضًا

مصادر