github.com/searKing/golang/go@v1.2.74/util/function/supplier/supplier.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package supplier 6 7 /** 8 * Represents a supplier of results. 9 * 10 * <p>There is no requirement that a new or distinct result be returned each 11 * time the supplier is invoked. 12 * 13 * <p>This is a <a href="package-summary.html">functional interface</a> 14 * whose functional method is {@link #get()}. 15 * 16 * @param <T> the type of results supplied by this supplier 17 * 18 * @since 1.8 19 */ 20 type Supplier interface { 21 /** 22 * Gets a result. 23 * 24 * @return a result 25 */ 26 Get() interface{} 27 } 28 type SupplierFunc func() interface{} 29 30 func (supplier SupplierFunc) Get() interface{} { 31 return supplier() 32 }