[디자인 패턴] - Flyweight
볼빵빵오춘기
Flyweight많은 수의 유사 객체를 만들 때, 공통된 데이터를 공유해서 메모리 사용량을 최소화하는 디자인 패턴이다. 예시 코드// Flyweight Interfaceinterface Shape { void draw(String color); // 외부 상태인 색상은 매번 넘김}// Concrete Flyweightclass Circle implements Shape { private final String shapeType = "Circle"; // 내부 상태 public void draw(String color) { System.out.println(color + " 색상의 " + shapeType + " 그리기"); }}// Flyweight Factorycla..