Java functional programming to leverage polymorphism
Introducing the factory
Let's consider a factory method that creates a profile based on some user input as follows:
public static Profile create(String profile) {
switch (profile) {
case ADMIN:
return new Admin();
case HR:
return new Hr...
elie29.hashnode.dev3 min read