code: private int findNextParaPos(int startPara, String paraStr) {
      if (allParas == null || allParas.size() < 1) {
        return -1;
      }
      if (startPara >= allParas.size() || startPara < 0) {
        startPara = 0;
      }
      if (startPara + 1 < allParas.size() && paraStr.equals(allParas.get(startPara + 1))) {
        return startPara + 1;
      }
      if (paraStr.equals(allParas.get(startPara))) {
        return startPara;
      }
      if (startPara - 1 >= 0 && paraStr.equals(allParas.get(startPara - 1))) {
        return startPara - 1;
      }
      return -1;
    }
docs: Heuristic try to find next position (dialog box or automatic iteration)
  Is paragraph same, next not empty after or before