Android-FAQ icon indicating copy to clipboard operation
Android-FAQ copied to clipboard

‫تفاوت Map و HashMap ؟

Open FatemehKavoosi opened this issue 5 years ago • 2 comments

FatemehKavoosi avatar Jul 09 '20 18:07 FatemehKavoosi

Map یک اینترفیس هست که متدهای لازم برای کار با مپ توی اون تعریف شده در حالی که HashMap یکی از کلاسهایی هست که این اینترفیس رو پیاده سازی کردن

اگر منظور از سوال مقایسه بین انواع مپ هست، قبلا اینجا با جزییات بیشتری درج شده

arashmidos avatar Jul 10 '20 15:07 arashmidos

How Map Is Different From HashMap?

  • HashMap does not maintain any insertion order of its elements hence it is quicker than Map.

  • In contrast to Map, HashMap can hold duplicate values.

  • It’s possible to implement the Map interface by utilizing its implementing classes. Contrariwise implementing the Map interface is what HashMap is all about.

  • The map does not allow storage of a single null key whereas HashMap can store multiple null values along with a single null key.

  • Unlike Map which is an interface, HashMap is a non-synchronized class of the Java Collections framework.

  • HashMap and TreeMap are two implementations of Map whereas the HashMap class uses Map interface.

لینک مرجع: https://www.ksolves.com/blog/java/difference-between-map-and-hashmap-in-java#:~:text=HashMap%20is%20a%20non%2Dsynchronized,to%20map%20key%2Dpair%20values.

MohsenNooriArdestani avatar May 14 '22 14:05 MohsenNooriArdestani