Last active
November 15, 2019 00:50
-
-
Save 128keaton/e14dcdd0d9bd6ded8d365ed3ffa20caf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void iterateListData(ListNode listNode) { | |
ListNode currentList = listNode; | |
int nestLevel = 0; | |
while (currentList != null ){ | |
StringBuilder nestIndicator = new StringBuilder("→"); | |
for (int i = 0; i < nestLevel; i++) { | |
nestIndicator.append("→"); | |
} | |
System.out.println(nestIndicator + " data = " + currentList.data); | |
currentList = currentList.next; | |
nestLevel++; | |
} | |
System.out.println("\n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment