Discuss / Java / lambda语法确实简化了代码,但是感觉对于理解java内部干了什么又多了一层理解难度。

lambda语法确实简化了代码,但是感觉对于理解java内部干了什么又多了一层理解难度。

Topic source

Loading...

#1 Created at ... [Delete] [Delete and Lock User]

语法确是很好理解,但是就像背课文一样,只是记住了,但是并不知道怎么来的😅

     CompletableFuture<Double> priceSina=cfCode.thenApplyAsync((code)->{
            return queryPrice((String) code,"https://finance.sina.com.cn");
        });

只能靠猜去理解它内部干了什么😂

        CompletableFuture<String> cfFromSina=CompletableFuture.supplyAsync(new Supplier<String>() {
            @Override
            public String get() {
                return queryCode("中国石油","https://finance.sina.com.cn/code");
            }
        });

🌙

#2 Created at ... [Delete] [Delete and Lock User]

就是少写了实现类

小绿又碰见你了


  • 1

Reply