Use Case 1

In the interface, we can define default method and return a function with input and output type using generic.

   default Function<T, Boolean> myLambda() {
        return (T input) -> input.stream().allMatch();
    }

In the concret class, we can define the type. Then at run time pass in the input.

That’s a good idea for functional programing.

Use Case 2

All the subclass extend from a same parent class and use @component, make sure will be scaned into the context.

Use @Autowired (by type) to initiate the List, at runtime we can get the list of all sub class.