一、Supplier简介
Supplier有什么好处?这个在网上也是众说纷纭,Supplier可能不像之前介绍的Predicate、Consumer、Function那么好理解。官方的介绍是:
表示结果的提供者,不要求每次调用Supplier时都返回新的或不同的结果。
源码如下:
@FunctionalInterface
public interface Supplier<T> {
/**
* Gets a result.
*
* @return a result
*/
T get(