public int removeVariable(@NonNull final String var) {
        if (!variablesSet.containsKey(var)) {
            return -1;
        }
        final int idx = variableList.indexOf(var);
        variableList.remove(idx);
        variableMap.remove(var);
        variablesSet.remove(var);
        wasModified = true;
        return idx;
    }
returns the list position where variable was removed, or -1 if var was not found
main/src/main/java/cgeo/geocaching/utils/formulas/VariableList.java