首页 > 其他 > 详细

ArrayList implement

时间:2014-05-07 07:56:54      阅读:382      评论:0      收藏:0      [点我收藏+]
public class ArrayList {

Object[] objects = new Object[10];
int index = 0;

public void add(Object object) {
if (index == objects.length) {
Object[] newObjects = new Object[objects.length*2];
System.arraycopy(newObjects, 0, objects, 0, objects.length);
objects = newObjects;
}
objects[index++] = object;
}


public int length() {
return index++;
}
}

ArrayList implement,布布扣,bubuko.com

ArrayList implement

原文:http://blog.csdn.net/majiakun1/article/details/25083271

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!