我需要创建一个循环来通过firstResults和latestResults并添加第一个'每个组件到我的_resultsPanel JPanel,但我不知道如何为此做一个正确的循环。
public void displayResults(Practice pr) {
_resultsPanel.removeAll();
ArrayList<TestResult> firstResults = pr.firstResults();
ArrayList<TestResult> latestResults = pr.latestResults();
// this is my attempt at the loop
for( int i = 0; i < pr.firstResults().size() && i< pr.latestResults().size();i++){
firstResults.get(i);
latestResults.get(i);
System.out.println(i);
// TODO Choose an appropriate loop to go through both firstResults and latestResults and add the i-th component of each to the results panel
}