strategy pattern
Putting one interchangeable algorithm behind an interface so it can be swapped at run time.
A context holds a strategy and delegates to it; in modern Java the strategy is usually a functional interface supplied by a lambda, method reference, enum constant or record.