private Map<String, TreeElement> getElementMap(final List<TreeElement> model) { final Map<String, TreeElement> elementMap = new HashMap<String, TreeElement>(model.size()); for (final TreeElement te : model) { if (te.getName() != null) { elementMap.put(te.getName(), te); } } return Collections.unmodifiableMap(elementMap); }
private Set<String> getRoots(List<TreeElement> model) { final Set<String> roots = new HashSet<String>(model.size()); for (final TreeElement tn : model) { if (tn.getName() != null) { roots.add(tn.getName()); } } for (final TreeElement tn : model) { for (final TreeElement child : tn.getElements()) { if (child.getClazz() != null) { roots.remove(child.getClazz()); } } } return roots; }