public class ListDemo {
public static void main(String[] args) {
List<String> list=new ArrayList<>();
list.add("java");
list.add("mybatis");
list.add("Springboot");
for(int i=0;i<list.size();i++){
System.out.println(list.get(i));
}
System.out.println("-------------------------");
Iterator<String> it = list.iterator();
while (it.hasNext()){
System.out.println(it.next());
}
System.out.println("----------------");
for (String s : list) {
System.out.println(s);
}
System.out.println("-----------------------");
list.forEach(s -> {
System.out.println(s);
});
}
}