code: private static Result findResultWithMaxEnd(List<Result> successResults) {
          return Collections.max(
                  successResults, new Comparator<Result>() {
                      @Override
                      public int compare(Result o1, Result o2) {
                          return Integer.valueOf(o1.end()).compareTo(o2.end());
                      }
                  });
      }
docs: Find the result with the maximum end position and use it as delegate.