The difference between a normal map and collections. Synchronized card.

In some open source android I found

 private Map<ImageView, String> imageViews=Collections.synchronizedMap(new
 WeakHashMap<ImageView, String>());

can anyone explain me the difference between Normal Mapandcollections.synchronizedmap

+5
source share
7 answers

java.util . , get() put() , .

, , Collections.synchronizedMap(). , get(), put keyset(), .
. http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedMap(java.util.Map)

+2

. ( () ). - (hashMap, synchronizedMap, WeakHashMap...). Java, .

Map , . , (, , , HashMap), .

synchronizedMap - . .

WeakHashMap, "" . WeakHashMap , ( weakRefences ). synchronizedMap, .

+1

"", , .

+1

Collections.synchronizedMap Map, , , .

+1

Collections.synchronizedMap() - . , . , . , , /, .

ConcurrentHashMap, Map.

+1

(List, Set, Queue, Map). , ; Collections, .

A thread safe collection can only be accessed one thread at a time.

URL: http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Collections.html

+1
source

All Articles