sling - Java do while loop to for each or for loop -


i'm pretty new java , trying figure out how convert below code loop or each loop.

do {     testpages.push(testparentpage);     if(homepage != null && testparentpage.getpath().equals(homepage.getpath())){         isparent = true;         break;     } } while((testparentpage = testparentpage.getparent()) != null);  

any appreciated! thanks!

it can rewritten in loop this:

for (; testparentpage != null; testparentpage = testparentpage.getparent()) {     testpages.push(testparentpage);     if(homepage != null && testparentpage.getpath().equals(homepage.getpath())){         isparent = true;         break;     } } 

thought must admit don't know if serves benefit.


Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -