Hi!
So, my question is how could I compare two objects. The code is shown below. The problem is that the first "if" statement is always true, even if it should be false. For instance, let's say childHierarchy and hierarchy[0] are equal to 'Contract'. In this case "if (childHierarchy.toString() != hierarchy[0].toString())" returns true. But why? Thanks.
Vector formTypes = new Vector();
formTypes = SystClasses.Folder.returnDataFromSelectQuery("select of_title from OrgFolders");
Object hierarchy[] = formTypes.toArray();
...
Vector childFormTypes = new Vector();
childFormTypes = SystClasses.Folder.returnDataFromSelectQuery("select of_childOf from OrgFolders");
Object childHierarchy[] = childFormTypes.toArray();
...
if (childHierarchy[i].toString() != hierarchy[0].toString()) // Ie node with children
{
System.out.println(childHierarchy[i].toString() + ", " + hierarchy[0].toString());
} else { // Ie Leaf
Object nodeSpecifier = hierarchy[i];
child = new DefaultMutableTreeNode(nodeSpecifier);
node.add(child);
}