Threadsafe vs Synchronized

前端 未结 7 1155
刺人心
刺人心 2021-02-02 11:01

I\'m new to java. I\'m little bit confused between Threadsafe and synchronized. Thread safe means that a method or class instance can be used by multiple threads at the same tim

相关标签:
7条回答
  • 2021-02-02 11:48

    In practice, performance wise, Thread safe, Synchronised, non-thread safe and non-synchronised classes are ordered as:

    Hashtable(slower)  <  Collections.SynchronizedMap  <  HashMap(fastest)
    
    0 讨论(0)
提交回复
热议问题