About 34,200,000 results
Open links in new tab
  1. Java HashMap put() Method - GeeksforGeeks

    Jan 20, 2025 · The put() method of the Java HashMap class is used to add or update the key-value pairs in the map. If the key already exists in the map, the previous value associated with …

  2. HashMap in Java - GeeksforGeeks

    Mar 7, 2025 · Performing Various Operations on HashMap 1. Adding Elements in HashMap in Java. To add an element to the map, we can use the put() method. However, the insertion …

  3. Java HashMap put() Method - W3Schools

    Add entries into a map: import java.util.HashMap; public class Main { public static void main(String[] args) { HashMap<String, String> capitalCities = new HashMap<String, String>(); …

  4. Java - Adding another String value to existing HashMap Key …

    Apr 18, 2015 · I was wondering if someone would be able to help with regards to adding another String value to an existing key within a HashMap in Java? I understand that you can add a Key …

  5. Java and HashMap - how to add to existing values ... - Stack Overflow

    Jan 27, 2014 · The best way to do this is probably to create an extension of HashMap specifically for integers with a method specifically for adding to a particular value in the manner you …

  6. Java HashMap - W3Schools

    Add Items. The HashMap class has many useful methods. For example, to add items to it, use the put() method:

  7. adding multiple entries to a HashMap at once in one statement

    Map<String, Integer> hashMap = new HashMap<>(immutableMap); If you can't use Java 9, you're stuck with writing a similar helper method yourself or using a third-party library (like …

  8. Add Elements to HashMap in Java - Online Tutorials Library

    Learn how to add elements to a HashMap in Java with examples and detailed explanations. Enhance your Java programming skills by mastering HashMap operations.

  9. Add, Update and Remove Key Value Pairs in Java HashMap

    Oct 11, 2020 · To modify a HashMap in Java, you can use the following built-in methods. Let's walk through this tutorial to explore in more details. Use the put (key, value) method to add the …

  10. Java HashMap put() Method - Java Guides

    The HashMap.put() method in Java provides a way to add or update key-value pairs in a HashMap. By understanding how to use this method, you can efficiently manage collections of …

  11. Some results have been removed