如何在jdk8中像这样使用for循环。
for (ClassAttendanceParent classAttendanceParent : list) {
TransportAttendanceFormBean tb = new TransportAttendanceFormBean();
tb.setDate(classAttendanceParent.getAttendancedate().toString());
}
in JDK8(如何转换上述for循环)
list.forEach((ClassAttendanceParent element) -> System.out.println(element.getAttendancedate()));
1条答案
按热度按时间cwtwac6a1#
试试这个
或(无需在每次迭代中创建新对象)