Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Set<Page> temp = new HashSet<Page>(){{
- add(root);
- }};
- Integer position = 0;
- addToMap(position, result, temp);
- while(temp.size() > 0) {
- Set<Page> childrenPages = temp;
- temp = new HashSet<>();
- for(Page page: childrenPages) {
- temp.addAll(page.getChildren());
- addToMap(position, result, childrenPages);
- }
- position++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement