Question: what is difference between array and hashmap?
Answer: 2 Answers. Array has values, HashMap has keys and values. ... Therefore, if you have a HashMap of keys and values, you can be sure that its keys are unique (values may contain duplicates across the key-value pairs). Arrays will maintain your order, and you can sort them.