Selecting and Varying Behavior
Strategy, Template Method with hooks, State and finite-state machines (including probabilistic ones), and Command with undo and command queues.
Strategy
Three idiomatic Java 25 ways to select a varying algorithm, taught against a real shipping-rate example: an interface with named classes, the same contract assigned as a lambda, and a closed set of carriers expressed as enum constants.
Template Method
Two idiomatic Java 25 ways to keep a processing sequence fixed while its steps vary, taught against a shipment order pipeline that validates, prices, and records an order the same three steps every time, with different content per sales channel: an abstract base with a final skeleton and overridden hooks, and the same skeleton written once as a value whose steps arrive as lambdas.
State and finite state machines
A shipment's lifecycle modeled two idiomatic Java 25 ways, an enum-plus-transition-table machine and a sealed-interface state dispatched through an exhaustive pattern-matching switch, plus a probabilistic machine whose weighted transitions are made reproducible by injecting a seeded RandomGenerator.
Command, undo, and command queues
Turning a warehouse desk's operations into Command objects with their own execute and undo, an undo/redo stack built on a Deque, a FIFO command queue for deferred batch processing, and a functional-interface shortcut for a queued action with nothing to undo.