列表处理中的List和ArrayList创建对象,添加列表元素,使用迭代器遍历 列表,使用迭代器删除列表中的指定元素。Java...

创建List和ArrayList对象可以使用构造函数,比如:List list = new ArrayList(); 添加列表元素可以使用add()方法,比如:list.add("Element"); 使用迭代器遍历列表可以使用Iterator()方法,比如:Iterator iterator = list.iterator(); 使用迭代器删除列表中的指定元素可以使用remove()方法,比如:iterator.remove();

猜你喜欢

转载自blog.csdn.net/weixin_42579969/article/details/129450953