About 117,000 results
Open links in new tab
  1. java - When to use HashMap over LinkedList or ArrayList and vice …

    Nov 2, 2011 · Map is an interface in the Java Collection Framework and a HashMap is one implementation of the Map interface. HashMap are efficient for locating a value based on a …

  2. How to create a HashMap with two keys (Key-Pair, Value)?

    Java 7+ contains a new Map.Entry<K,V> class that you can use as key for your map (or entry for your set). Java 9+ also contains a Map.entry(K k, V v) method to easily create new Map.Entry …

  3. What is a hash map in programming and where can it be used

    Apr 7, 2010 · Hashmap is used for storing data in key value pairs. We can use a hashmap for storing objects in a application and use it further in the same application for storing, updating, …

  4. What are the differences between a HashMap and a Hashtable in …

    HashMap, Hashtable in case of hash collisions they store the map entries in linked lists. From Java8 for HashMap if hash bucket grows beyond a certain threshold, that bucket will switch …

  5. java - Hashmap does not work with int, char - Stack Overflow

    Java didn't have generics from the beginning so a HashMap<Character, Integer> is really a HashMap<Object, Object>. The compiler does a bunch of additional checks and implicit casts …

  6. java - Storing a new object as the value of a hashmap ... - Stack …

    Note that it's generally though not always better to use interfaces for the variable types - and you can use the diamond operator for the constructor call, letting the compiler use type inference …

  7. java - Store an array in HashMap - Stack Overflow

    Sep 29, 2011 · The issue with your code lies in how you are using arrays (int[]) as keys in a HashMap. In Java, arrays do not override the equals() and hashCode() methods from Object. …

  8. java - How to correctly use HashMap? - Stack Overflow

    HashMap<String, Object> savedStuff = new HashMap<String, Object>(); Of course, you will still have to be careful to use the right type when extracting elements. Share

  9. java - Accessing a HashMap from a different class - Stack Overflow

    Mar 22, 2015 · You can either make your HashMap public, or create a getter for it: public HashMap<String, Integer> getPeople() { return people; } then you can access it using an …

  10. What is the difference between the HashMap and Map objects in …

    Jan 5, 2017 · The difference is that in the second implementation your reference to the HashMap will only allow the use of functions defined in the Map interface, while the first will allow the use …

Refresh