private void iterate( final LinkedList<NodeInterceptor> deque, final Node parent, final List<Node> children) { if (deque.isEmpty()) { for (Node child : children) { child.setParent(parent); } onLoadSuccess(parent, children); return; } NodeInterceptor interceptor = deque.poll(); interceptor .intercept(parent, children) .then( childrenList -> { iterate(deque, parent, childrenList); }); }