ConcurrentSkipListMap put() method in Java with Examples Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The put() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which associates the specified value with the specified key in this map. If the map previously contained a mapping for the key, the old value is replaced. Syntax: public V put(K key, V value) Parameter: The function accepts two mandatory parameters: key which specifies the key with which the specified value is to be associated value: which specifies the value to be associated with the specified key. Return Value: The function returns the previous value associated with the specified key. If there was no mapping for the specified key, then this method returns null. Below programs illustrate the above method: Program 1: Java // Java Program Demonstrate put() // method of ConcurrentSkipListMap import java.util.concurrent.*; class GFG { public static void main(String[] args) { // Initializing the map ConcurrentSkipListMap<Integer, Integer> mpp = new ConcurrentSkipListMap<Integer, Integer>(); // Adding elements to this map for (int i = 1; i <= 5; i++) mpp.put(i, i); // put() operation on the map System.out.println("After put(): " + mpp); } } Output: After put(): {1=1, 2=2, 3=3, 4=4, 5=5} Program 2: Java // Java Program Demonstrate put() // method of ConcurrentSkipListMap import java.util.concurrent.*; class GFG { public static void main(String[] args) { // Initializing the map ConcurrentSkipListMap<Integer, Integer> mpp = new ConcurrentSkipListMap<Integer, Integer>(); // Adding elements to this map for (int i = 1; i <= 9; i++) mpp.put(i, i); // put() operation on the map System.out.println("After put(): " + mpp); } } Output: After put(): {1=1, 2=2, 3=3, 4=4, 5=5, 6=6, 7=7, 8=8, 9=9} Reference: https://docs.oracle.com/javase/9/docs/api/java/util/concurrent/ConcurrentSkipListMap.html#put-K-V- Comment More infoAdvertise with us Next Article ConcurrentSkipListMap clone() method in Java with Examples T Twinkl Bajaj Follow Improve Article Tags : Misc Java Java-Collections Java - util package Java-Functions Java-ConcurrentSkipListMap Java-concurrent-package +3 More Practice Tags : JavaJava-CollectionsMisc Similar Reads ConcurrentSkipListMap size() method in Java with Examples The size() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which that is it returns the number of keys mapped to this map. The size() method is not a constant time operation. In case the map contains more than Integer.MAX_VALUE elements, the maximum value of the 2 min read ConcurrentSkipListMap remove() method in Java with Examples The remove() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which removes the mapping for the specified key from this map. The method returns null if there is no mapping for of that particular key. After this method is performed the size of the map is reduced. S 2 min read ConcurrentSkipListMap clone() method in Java with Examples The clone() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which returns a shallow copy of this ConcurrentSkipListMap instance. The keys and values themselves are not cloned. Syntax: ConcurrentSkipListMap.clone() Parameter: The function does not accept any param 2 min read ConcurrentSkipListMap clone() method in Java with Examples The clone() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which returns a shallow copy of this ConcurrentSkipListMap instance. The keys and values themselves are not cloned. Syntax: ConcurrentSkipListMap.clone() Parameter: The function does not accept any param 2 min read ConcurrentSkipListMap clear() method in Java with Examples The clear() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which removes all of the mappings from this map. This means that all the elements from the map are removed and an empty map is returned. Syntax: public void clear() Parameter: The function does not accep 2 min read ConcurrentSkipListMap equals() method in Java with Examples The equals() method of java.util.concurrent.ConcurrentSkipListMap is an in-built function in Java which to check the equality of this Map object with the specified object. The method returns true if the given object is also a map of the previous one and the two maps have the same mappings. Syntax: p 2 min read Like