hajjo 0 Junior Poster
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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.