反向操作

今天修改个东西,看到有一段代码被人优化了!!!

优化前

  public Optional<List<Map<String, String>>> getByCodesString type, List<String> codeList) {
        if codeList.size) <= DEFAULT_PAGE_SIZE) {
            return getByBatchtype, codeList);
        }

        return IntStream.range0, codeList.size) + DEFAULT_PAGE_SIZE - 1) / DEFAULT_PAGE_SIZE)
                .mapToObji -> codeList.subListi * DEFAULT_PAGE_SIZE, Math.minDEFAULT_PAGE_SIZE * i + 1), codeList.size))))
                .maplist -> getByBatchtype, list).orElsenew ArrayList<>)))
                .reducea, b) -> {
                    a.addAllb);
                    return a;
                });

    }    

private Optional<List<Map<String, String>>> getByBatchString type, List<String> codeList) {}

优化后

    public Optional<List<Map<String, String>>> getByCodesString type, List<String> codeList) {
        Optional<List<Map<String, String>>> result = null;
        if codeList.size) <= DEFAULT_PAGE_SIZE) {
            result = getByBatchtype, codeList);

            ifresult.isPresent) && CollectionUtils.isNotEmptyresult.get))){
                return result;
            }
            return Optional.empty);
        }

        result = IntStream.range0, codeList.size) + DEFAULT_PAGE_SIZE - 1) / DEFAULT_PAGE_SIZE)
                .mapToObji -> codeList.subListi * DEFAULT_PAGE_SIZE, Math.minDEFAULT_PAGE_SIZE * i + 1), codeList.size))))
                .maplist -> getByBatchtype, list).orElsenew ArrayList<>)))
                .reducea, b) -> {
                    a.addAllb);
                    return a;
                });
        ifresult.isPresent) && CollectionUtils.isNotEmptyresult.get))){
            return result;
        }
        return Optional.empty);
    }

 private Optional<List<Map<String, String>>> getByBatchString type, List<String> codeList) {}

Published by

风君子

独自遨游何稽首 揭天掀地慰生平

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注