Get the App
SLTechnology News&Howtos  ›  Database  › 

JDK Source Code Reading-4-Design pattern-Behavioral pattern

Shulou Source: shulou.com Published: 2022-06-01 08:17:47 10月02日 Update

1. Chain of responsibilities Model (Chain of responisibility)

Java.util.logging.Logger#log ()

Javax.servlet.Filter#doFilter ()

two。 Command mode (Command)

Java.lang.Runnable

Java.util.concurrent.Callable

3. Interpreter mode (Interpreter)

Java.text.Format

4. Iterator mode (Iterator)

Java.util.Iterator

Java.util.Enumeration

5. Observer mode (Observer)

Java.util.Observer/java.util.Observable (rarely used in real world though)

6. Policy Mode (Strategy)

Java.util.Comparator#compare (), Collections#sort ().

7. Template mode (Template Method)

Javax.servlet.http.HttpServlet, doXXX () in

Tags: Patterns commands templates policies responsibilities observers interpreters observations interpreters iterations source code behavior design patterns design Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Microsoft NVidia Redmi Shulou Tech Info