Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

What are the examples of Decorator design pattern in JDK?

Pragya Keshap answered on February 10, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • What are the design-patterns used in Spring framework?
  • java decorator pattern
  • Java design patterns
  • decorator design pattern
  • Decorator pattern
  • Java design patterns
  • Java design patterns
  • Java design patterns
  • Java design patterns
  • What are the design patterns involved in JDBC architecture?
  • Java template method pattern
  • Template Design Pattern In java
  • When to use the Composite design pattern in Java? Have you used it previously in your project?
  • What are the types of design patterns in Java?
  • What are some of the design patterns used in Java’s JDK library?
  • How Strategy design pattern is different from State design pattern in Java?
  • What is Template Method design pattern in Java?
  • What are the examples of Builder design pattern in JDK?
  • What are the examples of Command design pattern in JDK?
  • What are the examples of Interpreter design pattern in JDK?
  • What are the examples of Mediator design pattern in JDK?
  • What are the examples of Visitor design pattern in JDK?
  • What are the examples of Adapter design pattern in JDK
  • What design pattern is suitable to add new features to an existing object?
  • The Decorator Desing Pattern
  • 20. What is the Iterator design pattern and how is it used in Java? When did you use it? What are its pros and cons?
  • Java Decorator design pattern example of implementation
  • java decorator design pattern
  • decorator design pattern

  • What are the examples of Decorator design pattern in JDK?

    0

    In JDK there are many places where Decorator design pattern is

    used. Some of these are as follows:

    1. In java.io package many classes use Decorator pattern.

    Subclasses of java.io.InputStream, OutputStream, Reader

    and Writer have a constructor that can take the instance of

    same type and decorate it with additional behavior.

    2. In java.util.Collections, there are methods like

    checkedCollection(), checkedList(), checkedMap(),

    synchronizedList(), synchronizedMap(),

    synchronizedSet(), unmodifiableSet(), unmodifiableMap()

    and unmodifiableList() methods that can decorate an object

    and return the same type.

    3. In javax.servlet package, there are classes like

    javax.servlet.http.HttpServletRequestWrapper and

    HttpServletResponseWrapper that are based on Decorator

    design pattern

    https://www.digitalocean.com/community/tutorials/decorator-design-pattern-in-java-example

    Popularity 3/10 Helpfulness 1/10 Language java
    Source: Grepper
    Tags: decorator java
    Link to this answer
    Share Copy Link
    Contributed on Feb 10 2023
    Pragya Keshap
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.