public ContextItem[] findInRootContext(int[] types) { List<ContextItem> out = new ArrayList<ContextItem>(); for (TreeNode n : root.findChildrenByTypes(types)) { // todo -- revise to replace using value directly with a TreeNode instance out.add(new ContextItemImpl(n.getPath(), n.getValue())); } return out.toArray(new ContextItem[out.size()]); }