私は Java の初心者で、以下のコードを for ループまたは for each ループに変換する方法を理解しようとしています。
do {
    testPages.push(testParentPage);
    if(homePage != null && testParentPage.getPath().equals(homePage.getPath())){
        isParent = true;
        break;
    }
} while((testParentPage = testParentPage.getParent()) != null); 
どんな助けでも大歓迎です!ありがとう!