I have a collection of records whose variables I want to assign to a set of labels in a UI. The problem is that I have to write duplicate code for each record to be displayed, such as:
label.setName1("")
label.setDate1("")
label.setName2("")
label.setDate2("")
Is there a way to increment the number in the method, which is the position of the record in the collection through a loop or something so I don't have to have duplicate code in my class?