Tuesday, August 27, 2019

java - Examples of Design Patterns used in JDK











At an interview a while back I was asked for some examples of Design Patterns within the JDK.



Off the top of my head I was able to identify



Flyweight - as used in the String pool
Singleton - in java.lang.Runtime
Iterator - as used on Collections classes




Not that many.



What are the other good examples of Design Patterns as used in the JDK?


Answer



Observer interfaces, you have them out-of-the-box.



For a complete answer, read this: Examples of GoF Design Patterns in Java's core libraries


No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...