提交 9d01dd81 编写于 作者: 杜庆泉's avatar 杜庆泉

android 数组转换示例补充

上级 2076c9d6
...@@ -507,6 +507,23 @@ export class User { ...@@ -507,6 +507,23 @@ export class User {
export function arrayConvert():boolean{ export function arrayConvert():boolean{
// kotlin.collections.List 转换 Array
let kotlinList = mutableListOf("hello","world")
let utsArr1 = Array.fromNative(kotlinList)
if(!(utsArr1 instanceof UTSArray<string>)){
return false
}
// kotlin.Array 转换 Array
let kotlinArray = arrayOf("hello","world")
let utsArr2 = Array.fromNative(kotlinArray)
if(!(utsArr2 instanceof UTSArray<string>)){
return false
}
let b1 = byteArrayOf(-1,2,0,3,4,5) let b1 = byteArrayOf(-1,2,0,3,4,5)
let c1 = Array.fromNative(b1) let c1 = Array.fromNative(b1)
if(!(c1 instanceof UTSArray<Number>)){ if(!(c1 instanceof UTSArray<Number>)){
...@@ -533,6 +550,7 @@ export function arrayConvert():boolean{ ...@@ -533,6 +550,7 @@ export function arrayConvert():boolean{
return false return false
} }
return true return true
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册