Search code examples
javadesign-patternsio

What is the most used pattern in java.io?


I was asked this question recently during my job interview, and I couldn't answer it. So, what is the most used pattern in java.io and how is it used? What are other patterns used in common java libraries?


Solution

  • I guess they wanted to hear about the Decorator pattern which can be found in the various Streams, Readers and Writers.

    Other patterns (small selection):

    I'm pretty sure that one can find examples for almost all patterns listed on this wikipedia page in the Java SDK.