명명 방식 (1) 썸네일형 리스트형 [JAVA] Effective Java - 1. 정적 팩터리 메서드 public 생성자 보단 정적 메서드로 제공하는 것이 유리하다. 장점 1. 이름을 가질 수 있다. SecurityContext securityContext = SecurityContextHolder.createEmptyContext(); 여기서 빈 SecurityContext 객체를 생성한다는 것을 직관적으로 알 수 있다. 반환될 객체의 특성을 쉽게 묘사 가능 장점 2. 호출 될 때 마다 새로운 객체생성을 하지 않아도 된다. class ColorCollect { private static final Map colorMap = new HashMap(); public static Color getColor(String colorName) { Color color = colorMap.get(colorName).. 이전 1 다음