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