I'm a newbie to Thymeleaf.
I have two objects- Classroom & Student: each Classroom contains a List<Student> and I can have a list of classrooms: List<Classroom>.
What I want to be able to do with Thymeleaf is the equivalent of the below java code:
for(int i = 0; i < classroomList.size(); i++){
System.out.println(classroomList.get(i).getRoomName());
for(int x = 0; x < studentList.size(); x++){
System.out.println(studentList.get(x));
}
}
So the output would be: {classroom1{joe1,joe2}, classroom2{joe3}}...
But I need to be able to do this in HTML with Thymeleaf (by passing a list of classrooms) so I can make it look nice.
Any help is much appreciated. Thanks!
get()can be O(n). In both Java and Thymeleaf you want an iterator; in the latter case, you're looking forth:each.