JAVA日报
[编程语言教程]

arraylist 遍历方法
public static void function(){ ArrayList<String> name= new ArrayList<>(); name.add("???"); for (int i = 0; i < name.size(); i++) { System.out.println(name.get(i)); } }

public static void foreach(){
ArrayList<String> name= new ArrayList<>();
name.add(“????”);
for (String string : name) {
System.out.println(string);
}
}

public static void useIterator(){
ArrayList<String> name= new ArrayList<>();
name.add(“????”);
Iterator<String> it=name.iterator();
while(it.hasNext()){
System.out.println(it.next());
}
}

public static void foreach(){
ArrayList<Integer> list =new ArrayList<>();
list.add(1);
ListIterator<Integer>it=list.listIterator();

while(it.hasNext()){
System.out.println(it.next());
}
}

JAVA日报

原文地址:https://www.cnblogs.com/mumulailai/p/14161559.html

hmoban主题是根据ripro二开的主题,极致后台体验,无插件,集成会员系统
自学咖网 » JAVA日报