复制代码 代码如下:
/*
* List 大小可变数组
* version: 1.0
*/
function List() {
this.list = new Array();
};
/**
* 将指定的元素添加到此列表的尾部。
* @param object 指定的元素
*/
List.prototype.add = function(object) {
this.list[this.list.length] = object;
};
/**
* 将List添加到此列表的尾部。
* @param listObject 一个列表
*/
List.prototype.addAll = function(listObject) {
this.list = this.list.concat(listObject.list);
};
/**
* 返回此列表中指定位置上的元素。
* @param index 指定位置
* @return 此位置的元素
*/
List.prototype.get = function(index) {
return this.list[index];
};
/**
* 移除此列表中指定位置上的元素。
* @param index 指定位置
* @return 此位置的元素
*/
List.prototype.removeIndex = function(index) {
var object = this.list[index];
this.list.splice(index, 1);
return object;
};
/**
* 移除此列表中指定元素。
* @param object 指定元素
* @return 此位置的元素
*/
List.prototype.remove = function(object) {
var i = 0;
for(; i < this.list.length; i++) {
if( this.list[i] === object) {
break;
}
}
if(i >= this.list.length) {
return null;
} else {
return this.removeIndex(i);
}
};
/**
* 移除此列表中的所有元素。
*/
List.prototype.clear = function() {
this.list.splice(0, this.list.length);
};
/**
* 返回此列表中的元素数。
* @return 元素数量
*/
List.prototype.size = function() {
return this.list.length;
};
/**
* 返回列表中指定的 start(包括)和 end(不包括)之间列表。
* @param start 开始位置
* @param end 结束位置
* @return 新的列表
*/
List.prototype.subList = function(start, end) {
var list = new List();
list.list = this.list.slice(start, end);
return list;
};
/**
* 如果列表不包含元素,则返回 true。
* @return true or false
*/
List.prototype.isEmpty = function() {
return this.list.length == 0;
};
js,List
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。