import java.util.function.Supplier; public class JdkTest { private StoreView storeView; class ConfigItem { private final Supplier getter; public ConfigItem(final Supplier getter) { this.getter = getter; } } private ConfigItem supportUser = new ConfigItem<>(() -> storeView.get()); private ConfigItem supportUser2 = new ConfigItem<>(storeView::get); private class StoreView { public String get() { return "123"; } } public static void main(String[] args) { new JdkTest(); } }