private int findIndexOfBestMatch(final State<T> state, final T value, final int initialIndex) {
        // Get the key for the value.
        final Object key = getRowValueKey(value);
        if (key == null) {
            return -1;
        }

        int bestMatchIndex = -1;
        int bestMatchDiff = Integer.MAX_VALUE;
        final int rowDataCount = state.getRowDataSize();
        for (int i = 0; i < rowDataCount; i++) {
            final T curValue = state.getRowDataValue(i);
            final Object curKey = getRowValueKey(curValue);
            if (key.equals(curKey)) {
                final int diff = Math.abs(initialIndex - i);
                if (diff < bestMatchDiff) {
                    bestMatchIndex = i;
                    bestMatchDiff = diff;
                }
            }
        }
        return bestMatchIndex;
    }
Find the index within the {@link State} of the best match for the
specified row value. The best match is a row value with the same key,
closest to the initial index.

@param state        the state to search
@param value        the value to find
@param initialIndex the initial index of the value
@return the best match index, or -1 if not found
stroom-core-client-widget/src/main/java/com/google/gwt/user/cellview/client/HasDataPresenter.java