/** * Finds index for a FQN to retrieve. * * @param fqn * String representing the FQN. * @return Index where element should be retrieved from or negative value if one can not be * located. */ private int findRetrieveIndexFor(String fqn) { int size = size(); int min = 0; int max = size - 1; while (max >= min) { int mid = midpoint(min, max); int compare = getAt(mid).getFQN().compareTo(fqn); // if no difference then we have it if (0 == compare) { return mid; } // otherwise adapt min and max min = (compare < 0) ? mid + 1 : min; max = (compare > 0) ? mid - 1 : max; } return -1; }