首页 > 编程语言 > 详细

Java Supplier 供给型接口

时间:2021-09-06 02:16:35      阅读:21      评论:0      收藏:0      [点我收藏+]

源码展示

package java.util.function;

/**
 * Represents a supplier of results.
 *
 * There is no requirement that a new or distinct result be returned each
 * time the supplier is invoked.
 */
@FunctionalInterface
public interface Supplier<T> {

    /**
     * Gets a result.
     */
    T get();
}

示例

import java.util.function.Supplier;

public class Test {
    public static void main(String args[]) {
        Supplier<String > s = ()->{
            return "费哥哥,我爱你哦!";
        };
        System.out.println( s.get());
    }
}

Java Supplier 供给型接口

原文:https://www.cnblogs.com/feiqiangsheng/p/15225874.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!