Skip to content

Commit 98af5ed

Browse files
authoredFeb 8, 2021
fix: Java 동기화(Synchronized) 부분 오타 수정 (jbee37142#149)
- synchroziedList() -> synchronizedList() - synchroziedSet() -> synchronizedSet() - synchroziedMap() -> synchronizedMap()
1 parent 3633f7a commit 98af5ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎Java/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ lists.add(1);
184184

185185
필드에 Collection 이 불가피하게 필요할 때는 어떠한 방법을 사용할까? Java 에서는 `synchronized` 키워드를 사용하여 스레드 간 race condition 을 통제한다. 이 키워드를 기반으로 구현된 Collection 들도 많이 존재한다. `List`를 대신하여 `Vector`를 사용할 수 있고, `Map`을 대신하여 `HashTable`을 사용할 수 있다. 하지만 이 Collection 들은 제공하는 API 가 적고 성능도 좋지 않다.
186186

187-
기본적으로는 `Collections`라는 util 클래스에서 제공되는 static 메소드를 통해 이를 해결할 수 있다. `Collections.synchroziedList()`, `Collections.synchroziedSet()`, `Collections.synchroziedMap()` 등이 존재한다.
187+
기본적으로는 `Collections`라는 util 클래스에서 제공되는 static 메소드를 통해 이를 해결할 수 있다. `Collections.synchronizedList()`, `Collections.synchronizedSet()`, `Collections.synchronizedMap()` 등이 존재한다.
188188
JDK 1.7 부터는 `concurrent package`를 통해 `ConcurrentHashMap`이라는 구현체를 제공한다. Collections util 을 사용하는 것보다 `synchronized` 키워드가 적용된 범위가 좁아서 보다 좋은 성능을 낼 수 있는 자료구조이다.
189189

190190
</br>

0 commit comments

Comments
 (0)
Please sign in to comment.