HashMap Flashcards

1
Q
  1. What are the classes we have in map interface?
  2. What will happen if i give same key , value pair again in hashmap?
    3.What will happen if i give same key , different value pair again in hashmap?
  3. Does HashMap follows insertion Order ?
  4. If i insert Key value with New key and same value what will happen?
  5. To get the records we can use key value ?
A
  1. HashMap, LinkedHashMap,
    Legacy Class: HashTable, properties
    Map - SortedMap, TreeMap, Navigable Map
  2. It won’t change anything, it remains unchanged.
  3. it will change the value
  4. No , there is no insertion order for HAshMap.
  5. It will add a new record key map in the heap memory
  6. Yes key should be used bcoz value can have duplicate so

hm.get(10);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly