Use cases of Supplier in java 8
Introduction: Supplier<T> is a functional interface in the Java ,with one abstract method named get(). Which will return an instance of T. In general we can say Supplier is a factory that keeps on giving without expecting any input. Syntax. Here get method return T instance without expecting any parameter as input. public abstract T get(); We already know that for any abstract method of functional interface we can implement using lamda expression. Eg: Supplier<Exception> exceptionFactory = () -> new RuntimeException("error"); When we execute above statement RuntimeException instance not created by the JVM why? lamda expressions are lazy until unless we invoke the method of functional interface it will not evaluated. so when we call exceptionFactor...