java – Recursive list of ordered components

I'm trying to get properly ordered components from an interface without having a local variable rowComponents on the outside, and here is my current code.

Reason is because ordersedComponents will be in Interface.java and getChildren will be in ComponentDefinitions.java and I want a more controllable code.

I was also thinking of switching from List to a one-dimensional array and I will soon be removing the static elements that I separate.

Public static list CommandedComponents = new ArrayList();

/ **
* returns the ordered components
*
* @param interfaceId
* @return The components of an interface sorted
* /
Public static list getOrderedComponents () {

orderedComponents.clear ();

for (int i = 0; i <inter.getComponents (). length; i ++) {

// if all compositions are added, stop the loop
if (ordersComponents.size () == inter.getComponents (). length)
Pause;

if (CommandedComponents.isEmpty () && inter.getComponent (i) .hasParent ()
&&! ordersComponents.contains (inter.getComponent (i) .getParentId ()))
Carry on;

// do the magic
getAllChildren (i);

}
return the ordered components;
}

empty static public getAllChildren (int componentId) {

// retrieve the current component definitions
ComponentDefinitions component = inter.getComponent (componentId);

// TODO first parent of parents
// if the component has a parent and it is not added to the list, add it
if (component.hasParent () &&! OrderComponents.contains (component.getParentId ()))) {
CommandedComponents.add (component.getParentId ());
}

// if the component is not added to the list, add it
if (! ordersComponents.contains (Component.componentId)) {
CommandedComponents.add (component.componentId);
}

// walk through all the children of the current components and add their children
for (int j = 0; j <inter.getComponent (componentId) .getChilds (). size (); j ++) {
ComponentDefinitions child = inter.getComponent (componentId) .getChilds (). Get (j);
getAllChildren (child.componentId);
}
}

Please, let me know what improvements could be made here and what I am doing wrong or that it is desirable to change.