map()
与Function
界面相关联。以及如何知道其他方法与哪些接口相关联,例如findFirst()
?
答案 0 :(得分:1)
map()与功能接口相关联
不,不是。对于标记java-stream的存在,它只是另一个具有以下语法的API from the class Stream
:
<main class="new-collection-wrapper">
<section class="new-collection-card">
<div class="new-collection-card-img">
<img src="http://www.petmania.ie/images/default-source/cat/petmania-kitten-1.jpg?sfvrsn=4" alt="new collection" alt="new collection">
</div>
<div class="new-collection-content">
<h3>AW19 collection</h3>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Corporis, a sequi molestias nam odit sunt. Unde dolore fugit suscipit amet.</p>
<a href="#" class="call-to-action"><span>JOIN</span></a>
</div>
</section>
<!-- End of New Collection -->
</main>
是的,在<R> Stream<R> map(Function<? super T,? extends R> mapper)
中使用的参数是Function
。您可以在JDK的FunctionalInterface
模块(上述Java-9)的java.util.function
包中找到类似的FunctionalInterface
。