Java assignment issues - Is this atomic?

前端 未结 4 1698
刺人心
刺人心 2021-02-14 22:01

I\'ve got some questions about Java\'s assigment.

  • Strings

I\'ve got a class:

public class Test {
 private String s;

 public synchro         


        
4条回答
  •  再見小時候
    2021-02-14 22:20

    Rather than wrapping your HashMap in something to make it synchronized, consider using a java.util.concurrency.ConcurrentHashMap instead.

    This is an updated version of HashMap that guarantees "Retrievals reflect the results of the most recently completed update operations holding upon their onset.".

提交回复
热议问题