For an interview, a simple answer:

1 Policy Mode:

Define a policy interface, different implementation classes provide different specific policy algorithms, and they can be replaced with each other.

2 Simple factory mode

Define a factory for creating objects that generate different objects according to different conditions.

Abstract factory pattern

Provides an interface for creating a series of related or interdependent objects without specifying their concrete classes. The Abstract factory pattern, also known as the Kit pattern, belongs to the object creation pattern.

(Retorfit is useful to have an abstract Factory class in CallApdater.)

Decorator mode

Adding extra functionality to an object dynamically (Java IO streams)

5 Proxy Mode

Encapsulate the proxied object and restrict access to the proxied object (retrofit.create () in Retrofit generates a dynamic proxied object)

6 Adapter Mode

Convert the interface of a class to another interface that the customer wants (the Adapter class in Android RecycleView implements the Adapter pattern)

7. Builder mode

Separate the construction of a complex object from its representation (most classes that use the Bulid () method use this design pattern, such as OKHttpClient).

8 Observer Mode

RxJava defines a one-to-many dependency that allows multiple observer objects to listen on a topic object at the same time and notify all observers when its state changes.

9 Singleton mode

Ensure that a class has only one instance and provide a global point of control to access it.