Java ConcurrentHashMap put() MethodThe put() method of ConcurrentHashMap class maps the specified key to the specified value in this table. SyntaxParameterkey - key with which the specified value is to be associated value - value to be associated with the specified key ReturnsThe previous value associated with key, or null if there was no mapping for key ThrowsNullPointerException. Example 1Test it NowOutput: Mappings are: {AAA=10, CCC=25, BBB=15, EEE=30, DDD=255} is 255 present? :: true Example 2Test it NowOutput: Mappings are: {python=20, c++=30, java=10, c=25, .net=15} is java present? :: true
Next TopicJava ConcurrentHashMap
|