thread safe map for java

前端 未结 7 860
忘掉有多难
忘掉有多难 2020-12-09 14:44

i need a thread safe map, i have something like this: (i\'m very new to java)

 public static class Manager
        {
        static 
        {
//something wr         


        
7条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-09 15:04

    from java.util.concurrent

    ConcurrentHashMap
    ConcurrentMap
    ConcurrentNavigableMap
    ConcurrentHashMap
    ConcurrentSkipListMap
    

    from java.util.Collections

    Collections.synchronizedMap(Map m)
    Collections.synchronizedNavigableMap(NavigableMap m)
    Collections.synchronizedSortedMap(SortedMap m)
    

提交回复
热议问题