Adapter Pattern
The adapter pattern converts an incompatible object
into a form that a module
accepts. This allows separate modules of code to communicate without coupling
them together. The Arrays#asList(Object[])
method is an example
of the adapter pattern.
Decorator Pattern
The decorator pattern provides additional behavior
to an object by wrapping
it with a delegator. This provides a flexible alternative to creating multiple
subclasses. The Collections#unmodifiableList(List)
method is an
example of the decorator pattern.
Flyweight Pattern
The flyweight pattern reduces the memory footprint
of an application by reusing
objects. This is useful when a large number of immutable objects are frequently
instantiated. The Integer#valueOf(String)
method is an example of the
flyweight pattern.