twaver.List Class
列表对象
这是一个集合类,封装了数组对象,增加了更加人性化的接口,方便对数据进行查改增删等操作
Constructor
Item Index
Methods
- twaver.List.add
- twaver.List.addAll
- twaver.List.clear
- twaver.List.contains
- twaver.List.forEach
- twaver.List.forEachReverse
- twaver.List.get
- twaver.List.getClassName
- twaver.List.indexOf
- twaver.List.isEmpty
- twaver.List.remove
- twaver.List.removeAt
- twaver.List.set
- twaver.List.size
- twaver.List.sort
- twaver.List.toArray
- twaver.List.toList
Methods
twaver.List.add
(
Number
-
item -
[index]
在指定的序号上添加一个子项
Parameters:
-
itemObject添加的数据对象
-
[index]Number optional添加的数据对象的序号,如果序号为空,则添加在队列的最后一个位置
Returns:
Number:
返回list的长度
twaver.List.addAll
(
-
array
在列表的末尾添加多个元素,并返回它的长度
Parameters:
-
arrayObject添加的子项
twaver.List.clear
()
Array
清空列表中的内容
Returns:
Array:
返回含有被删除的元素的数组
twaver.List.contains
(
Boolean
-
item
判断列表中是否包含指定的项
Parameters:
-
itemObject指定的子项
Returns:
Boolean:
true为包含,否则为false
twaver.List.forEach
(
-
f -
[scope]
循环遍历列表中所有的数据
Parameters:
-
fFunction遍历时的回调函数
-
[scope]Object optional回调函数的作用域,为空时,指的是window
twaver.List.forEachReverse
(
-
f -
[scope]
反向循环遍历列表中所有的数据
Parameters:
-
fFunction遍历时的回调函数
-
[scope]Object optional回调函数的作用域,为空时,指的是window
twaver.List.get
(
Object
-
index
获取指定序号上的数据项
Parameters:
-
indexNumber指定的序号
Returns:
Object:
指定序号上的数据项
twaver.List.getClassName
()
String
获取类的名称
Returns:
String:
类名
twaver.List.indexOf
(
String
-
item
Parameters:
-
itemString
Returns:
String:
twaver.List.isEmpty
()
Boolean
判断列表是否为空
Returns:
Boolean:
如果为空返回true,否则返回false
twaver.List.remove
(
Number
-
item
移除列表上指定的项
Parameters:
-
itemObject移除的列表项
Returns:
Number:
数据项的序号
twaver.List.removeAt
(
String
-
index
移除列表上指定的序号上的数据项
Parameters:
-
indexNumber指定的序号值
Returns:
String:
twaver.List.set
(
String
-
index -
item
给指定的序号上设置数据项
Parameters:
-
indexNumber指定的序号值
-
itemObject指定的数据项
Returns:
String:
twaver.List.size
()
Number
列表的长度
Returns:
Number:
列表的长度
twaver.List.sort
(
twaver.List
-
[sortFunction]
按照指定的排序方法排序
Parameters:
-
[sortFunction]Function optional可选,排序的函数
Returns:
twaver.List.toArray
(
Array
-
matchFunction -
[scope]
根据指定的函数将列表转成数组
Parameters:
-
matchFunctionFunction转化时的条件函数
-
[scope]Object optional条件函数的作用域,为空时指的是window
Returns:
Array:
twaver.List.toList
(
String
-
matchFunction -
scope
Parameters:
-
matchFunctionString -
scopeString
Returns:
String:
