concrete iterator -- implements --> iterator <-- has -- aggregate <-- implements -- concrete aggregate
concrete iterator -- has --> concrete aggregate
Adaptee <-- extends -- Adapter -- implements --> Target(interface), used by client
Abstract SuperClass: abstract method1, abstract method2, do() {method1(), method2()}
ChildClass: method1, method2
SuperClass child = new ChildClass(...) // Liskov Substitution Principle: LSP
Framework(Abstract classes):
Factory Product
createProduct()
Concrete classes:
MyFactory MyProduct
public class Singleton {
private static Singleton myInstance;
private Singleton() {
}
public static Singleton getInstance() {
if (myInstance == null) {
myInstance = new Singleton();
}
return myInstance;
}
}