+ public static <T extends StoreTreeNode<T>> T findNodeChecked(final T tree, final InstanceIdentifier path) {
+ T current = tree;
+ List<PathArgument> nested = new ArrayList<>(path.getPath().size());
+ for(PathArgument pathArg : path.getPath()) {
+ Optional<T> potential = current.getChild(pathArg);
+ nested.add(pathArg);
+ Preconditions.checkArgument(potential.isPresent(),"Child %s is not present in tree.",nested);
+ current = potential.get();
+ }
+ return current;
+ }
+