private int count(List<ManifestNode> list) { if (list == null) { return 0; } int thisList = list.size(); for (ManifestNode entry : list) { thisList += count(entry.getChildren()); } return thisList; }
private ManifestNode findNode(String key, List<ManifestNode> list) { if (list == null) { return null; } // For every node for (ManifestNode node : list) { // Check this node if (node.getKey().equals(key)) { return node; } // And check children ManifestNode descendent = findNode(key, node.getChildren()); if (descendent != null) { return descendent; } } // Not found return null; }