最常用的便是for循环查询:
for(StudentRecord record : records) { if(record.getYear() == yearSearch) { System.out.println(record.getId()+" " + record.getFirst()+ " "+ record.getLast() + "+record.getYear()); count++; } }
参考:https://www.coder.work/article/6150618