[DS-707] Inefficient use of keySet iterators

git-svn-id: http://scm.dspace.org/svn/repo/dspace/trunk@5474 9c30dcfa-912a-0410-8fc2-9e0234be79fd
This commit is contained in:
Graham Triggs
2010-10-19 21:55:07 +00:00
parent 5d22e55b48
commit 7c716b9e9b
10 changed files with 63 additions and 97 deletions

View File

@@ -1255,23 +1255,10 @@ public class Group extends DSpaceObject
// so now to establish all parent,child relationships we can iterate
// through the parents hash
Iterator<Integer> i = parents.keySet().iterator();
while (i.hasNext())
for (Map.Entry<Integer, Set<Integer>> parent : parents.entrySet())
{
Integer parentID = i.next();
Set<Integer> myChildren = getChildren(parents, parentID);
Iterator<Integer> j = myChildren.iterator();
while (j.hasNext())
{
// child of a parent
Integer childID = j.next();
((Set<Integer>) parents.get(parentID)).add(childID);
}
Set<Integer> myChildren = getChildren(parents, parent.getKey());
parent.getValue().addAll(myChildren);
}
// empty out group2groupcache table