public void buildTree(List<Fool> treeArr,Fool tr) {
if(tr.getChild().size() == 0)
{
for (Fool cur : treeArr )
{
if (cur.getParentId().intValue() == tr.getRight().getRightId())
{
tr.getChild().add(cur);
cur.setParent(tr);
buildTree(treeArr, cur);
}
}
}
}
there is around 10000 data, and the code is very slow. Its taking 8.5 second, I need to speed it up.. any way to improve the performance of the above code.