SortedConfigurableGroup (Map<String, Node<SortedConfigurableGroup>> tree, String groupId) { Node<SortedConfigurableGroup> node = tree.remove(groupId); if (node.myChildren != null) { for (Iterator<Object> iterator = node.myChildren.iterator(); iterator.hasNext(); iterator.remove()) { // expected type String childId = (String)iterator.next(); node.myValue.myList.add(getGroup(tree, childId)); } } return node.myValue; }