Java Design Pattern: Composite

Composite pattern is relatively simple, but it has been used in many designs, such as SWT, eclipse workspace, etc. It basically produce a hierarchical tree which can be accessed by using a uniform method. Class Diagram The following code implements the following tree structure. Java Code import java.util.List; import java.util.ArrayList;   //Component interface Component { … Read more