LinkedList<Integer> list = new LinkedList<>();
// 添加元素
for (int i = 0; i < list.size(); i++) {
System.out.println(list.get(i));
}
LinkedList<Integer> list = new LinkedList<>();
// 添加元素
Iterator<Integer> iterator = list.iterator();
while (iterator.hasNext()) {
System.out.println(iterator.next());
}
LinkedList<Integer> list = new LinkedList<>();
// 添加元素
for (Integer value : list) {
System.out.println(value);
}
LinkedList<Integer> list = new LinkedList<>();
// 添加元素
list.forEach(System.out::println);
LinkedList<Integer> list = new LinkedList<>();
// 添加元素
list.stream().forEach(System.out::println);