
#ArrayList<T> 动态数组演示

#预处理函数: 可配置 MKScript 脚本加载后自动运行
#mkscript_config_auto_start()

#预处理函数: 初始化MKScript窗口大小
mkscript_window_initial_size( 500, 400 )

for int i = 1 to 1

    ArrayList<string> list = {}   

    arraylist_add(list, "aaa")

    string c = "bbb"

    arraylist_insert(list, 1, c)

    arraylist_insert(list, 0, arraylist_get(split("aaa,bbb,ccc", ","), 2))

    arraylist_add(list, "aaa")

    println(list)

    println("arraylist_index_of:" +  arraylist_index_of(list, "aaa"))

    println("arraylist_last_index_of:" + arraylist_last_index_of(list, "aaa"))

    println("arraylist_contains:" + arraylist_contains(list, "aaab"))

    println("arraylist_remove:" + arraylist_remove(list, "aaa"))

    println(list)

    println("arraylist_remove_index:" + arraylist_remove_index(list, 1))

    println(list)

    println("arraylist_set:" + arraylist_set(list, 1, "xxx"))

    println(list)

    println("arraylist_get:" + arraylist_get(list, 1))

    println("arraylist_get_size:" + arraylist_get_size(list))    
    
    println(list)
    
    arraylist_clear(list)
    
    println("arraylist_get_size:" + arraylist_get_size(list))
    
    println(list)

next
