Tìm hiểu về Functional Interface Supplier trong Java
Supplier là một Functional Interface, do đó nó chỉ chứa một phương thức abstract như sau:
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | package java.util.function; /**  * Represents a supplier of results.  *  * <p>There is no requirement that a new or distinct result be returned each  * time the supplier is invoked.  *  * <p>This is a <a href="package-summary.html">functional interface</a>  * whose functional method is {@link #get()}.  *  * @param <T> the type of results supplied by this supplier  *  * @since 1.8  */ @FunctionalInterface public interface Supplier<T> {     /**      * Gets a result.      *      * @return a result      */     T get(); } | 
Interface này đơn giản chỉ là trả về giá trị trong context mà nó đang được sử dụng bằng phương thức get(). Ví dụ như mình có danh… Read More
 
 
