디자인 패턴(Design Pattern’s) Quick Reference 이미지이다. 이 이미지는 http://www.mcdonaldland.info/2007/11/28/40/ 에서 pdf 파일을 다운로드 받아서 이미지로 캡처했다.
날짜: 2008 7월 3
Java Collection
Collection은 레퍼런스 타입들을 유지하기 위한 메카니즘이다.
Java는 대충 아래의 클래스들로 구성이 되어 있습니다. 추가적으로 java.util.concurrent 패키지에 확장 Collection 클래스들도 있습니다.
Collection : 가장 상위 인터페이스
+ Set : 중복요소가 없는 컬렉션으로, 하위 인터페이스로 SortedSet이 있습니다.
+ List : 순서가 있는 컬렉션으로, 인덱스로 위치를 지정하여 값을 찾을 수 있습니다.
+ Queue : FIFO의 구조로 객체를 유지하는 컬렉션으로, 하위 인터페이스는 BlockingQueue가 있습니다.
+ Map : 키를 값에 매핑 하는 컬렉션으로, 중복키를 허용하지 않는다. 하위 인터페이스들은 ConcurrentMap, SortedMap이 있습니다.
Set
– AbstractSet, CopyOnWriteArraySet, EnumSet, HashSet, JobStateReasons, LinkedHashSet, TreeSetList
– AbstractList, AbstractSequentialList, ArrayList, AttributeList, CopyOnWriteArrayList, LinkedList, RoleList, RoleUnresolvedList, Stack, VectorQueue
– AbstractQueue, ArrayBlockingQueue, ConcurrentLinkedQueue, DelayQueue, LinkedBlockingQueue, LinkedList, PriorityBlockingQueue, PriorityQueue, SynchronousQueueMap
– AbstractMap, Attributes, AuthProvider, ConcurrentHashMap, EnumMap, HashMap, Hashtable, IdentityHashMap, LinkedHashMap, PrinterStateReasons, Properties, Provider, RenderingHints, TabularDataSupport, TreeMap, UIDefaults, WeakHashMap
IllegalMonitorStateException in Object wait(), notify(), notifyall()
java.lang 패키지에 IllegalMonitorStateException 클래스가 있습니다.
이 넘은 오븍젝트의 락을 가지지 않는 상태에서 오브젝트의 상태를 변경할려고 시도할 경우 발생하는 예외처리 클래스 입니다.
만약에 wait(), notify(), notifyAll() 등의 메쏘드들을 사용할 경우 아래처럼 간단하게 해결 할 수 있습니다.
thisObject.wait() 를 아래처럼 바꿔준다.synchronized(thisObject) {
thisObject.wait ();
}