returns the index of the item with the specified ID
If the ID is not found, the method returns -1
With tree-like structures, use the getBranchIndex method.