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

من موسوعة حسوب
اذهب إلى التنقل اذهب إلى البحث
ط (استبدال النص - 'Kotlin Functions' ب'Kotlin Function')
ط
 
سطر 1: سطر 1:
 
<noinclude>{{DISPLAYTITLE: الدالة <code>toLongArray()‎</code> في Kotlin}}</noinclude>
 
<noinclude>{{DISPLAYTITLE: الدالة <code>toLongArray()‎</code> في Kotlin}}</noinclude>
تحول الدالة <code>toLongArray()‎</code> [[Kotlin/Array|المصفوفة العامة]] (أي من النوع <code>Array<Long>‎</code>) أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها إلى [[Kotlin/Array|مصفوفة]] من النوع <code>[[Kotlin/LongArray/index|LongArray]]</code>.
+
تحول الدالة <code>toLongArray()‎</code> [[Kotlin/Array|المصفوفة العامة]] (أي من النوع <code>Array<Long>‎</code>) أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها إلى [[Kotlin/Array|مصفوفة]] من النوع <code>[[Kotlin/LongArray|LongArray]]</code>.
 
==البنية العامة==
 
==البنية العامة==
 
<syntaxhighlight lang="kotlin">
 
<syntaxhighlight lang="kotlin">
سطر 8: سطر 8:
 
</syntaxhighlight>
 
</syntaxhighlight>
 
==القيمة المعادة==
 
==القيمة المعادة==
تعاد [[Kotlin/Array|مصفوفة]] من النوع [[Kotlin/LongArray/index|<code>LongArray</code>]] تحوي جميع عناصر [[Kotlin/Array|المصفوفة العامة]] (أي من النوع <code>Array<Long>‎</code>) أو [[Kotlin/collections|المجموعة]] المعطاة.
+
تعاد [[Kotlin/Array|مصفوفة]] من النوع <code>[[Kotlin/LongArray|LongArray]]</code> تحوي جميع عناصر [[Kotlin/Array|المصفوفة العامة]] (أي من النوع <code>Array<Long>‎</code>) أو [[Kotlin/collections|المجموعة]] المعطاة.
 
==أمثلة==
 
==أمثلة==
استعمال الدالة <code>()toLongArray</code> <nowiki/>لتحويل مصفوفة من النوع <code>Array<Long>‎</code> إلى النوع <code>[[Kotlin/LongArray/index|LongArray]]</code>:<syntaxhighlight lang="kotlin">
+
استعمال الدالة <code>()toLongArray</code> <nowiki/>لتحويل مصفوفة من النوع <code>Array<Long>‎</code> إلى النوع <code>[[Kotlin/LongArray|LongArray]]</code>:<syntaxhighlight lang="kotlin">
 
import java.util.Arrays
 
import java.util.Arrays
  
سطر 29: سطر 29:
 
*الدالة <code>[[Kotlin/collections/toHashSet|toHashSet()]]‎</code>: تعيد كائنًا من النوع <code>HashSet</code> لجميع عناصر [[Kotlin/Array|المصفوفة]] أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها.
 
*الدالة <code>[[Kotlin/collections/toHashSet|toHashSet()]]‎</code>: تعيد كائنًا من النوع <code>HashSet</code> لجميع عناصر [[Kotlin/Array|المصفوفة]] أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها.
 
*الدالة <code>[[Kotlin/collections/toIntArray|toIntArray()‎]]</code>: تحول [[Kotlin/Array|المصفوفة العامة]] (أي من النوع <code>Array<Int>‎</code>) أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها إلى [[Kotlin/Array|مصفوفة]] من النوع <code>[[Kotlin/IntArray/index|IntArray]]</code>.
 
*الدالة <code>[[Kotlin/collections/toIntArray|toIntArray()‎]]</code>: تحول [[Kotlin/Array|المصفوفة العامة]] (أي من النوع <code>Array<Int>‎</code>) أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها إلى [[Kotlin/Array|مصفوفة]] من النوع <code>[[Kotlin/IntArray/index|IntArray]]</code>.
*الدالة <code>[[Kotlin/collections/toList|toList()‎]]</code>: تحول [[Kotlin/Array|المصفوفة]] أو [[Kotlin/Iterable|المجموعة التكرارية]] أو [[Kotlin/Map|الخريطة]] التي استُدعيت معها إلى قائمة.
+
*الدالة <code>[[Kotlin/collections/toList|toList()‎]]</code>: تحول [[Kotlin/Array|المصفوفة]] أو [[Kotlin/Iterable|المجموعة التكرارية]] أو [[Kotlin/collections/Map|الخريطة]] التي استُدعيت معها إلى قائمة.
 
*الدالة <code>[[Kotlin/collections/toMap|toMap()‎]]</code>: تحول الكائن المستدعى معها إلى خريطة أو تضيف محتوى ذلك الكائن إلى خريطة موجودة مسبقًا.
 
*الدالة <code>[[Kotlin/collections/toMap|toMap()‎]]</code>: تحول الكائن المستدعى معها إلى خريطة أو تضيف محتوى ذلك الكائن إلى خريطة موجودة مسبقًا.
 
*الدالة <code>[[Kotlin/collections/toMutableList|toMutableList()‎]]</code>: تحول [[Kotlin/Array|المصفوف]] أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها إلى [[Kotlin/MutableList|قائمة متغيرة]]. 
 
*الدالة <code>[[Kotlin/collections/toMutableList|toMutableList()‎]]</code>: تحول [[Kotlin/Array|المصفوف]] أو [[Kotlin/collections|المجموعة]] التي استُدعيت معها إلى [[Kotlin/MutableList|قائمة متغيرة]]. 
سطر 41: سطر 41:
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin]]
 
[[تصنيف:Kotlin Function]]
 
[[تصنيف:Kotlin Function]]
 +
[[تصنيف:Kotlin Collection]]

المراجعة الحالية بتاريخ 11:44، 8 سبتمبر 2018

تحول الدالة toLongArray()‎ المصفوفة العامة (أي من النوع Array<Long>‎) أو المجموعة التي استُدعيت معها إلى مصفوفة من النوع LongArray.

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

fun Array<out Long>.toLongArray(): LongArray 
fun Collection<Long>.toLongArray(): LongArray

القيمة المعادة

تعاد مصفوفة من النوع LongArray تحوي جميع عناصر المصفوفة العامة (أي من النوع Array<Long>‎) أو المجموعة المعطاة.

أمثلة

استعمال الدالة ()toLongArray لتحويل مصفوفة من النوع Array<Long>‎ إلى النوع LongArray:

import java.util.Arrays

fun main(args: Array<String>) {
    val array: Array<Long> = arrayOf(4, 5, 6)

    println(Arrays.toString(array.toLongArray())) // [4, 5, 6]
    println(array.toLongArray().javaClass.kotlin.qualifiedName) // kotlin.LongArray
}

انظر أيضًا

مصادر