containskey

containskeycontainskey
  1. Unfortunately , as written , it is possible for another thread to insert a value with the same key between the time the containsKey () method returns and the time the put () method is called .

    不幸的是,在containsKey()方法返回到put()方法被调用这段时间内,可能会有另一个线程也插入一个带有相同键的值。

  2. When a Map is accessed from multiple threads , it 's common to use either containsKey () or get () to find out whether a given key is present before storing the key / value pair .

    当一个Map被从多个线程访问时,通常使用containsKey()或者get()来查看给定键是否在存储键/值对之前出现。