Why Map does not extend Collection interface?

Suneet Agrawal
2 min readApr 28, 2021

Collections in any language is an interface that stores similar data type objects and provides an iteration functionality. The common extensions of Collection are List and Set.

The Map is a well-known data structure used to store key-value pairs where keys will be unique.

This post was originally posted at https://agrawalsuneet.github.io/blogs/why-map-does-not-extend-collection-interface/ and reposted on Medium on 28th April 2021.

We can take a reference of any language but let’s look at the example of Java for reference as Collection Framework from Java is very popular.

Java has Iterable interface which is extended by Collection. The Collection is further extended by List, Queue and Set which has their different-different implementations but the unique thing notice is that the Map interface doesn’t extend Collection interface.

Why Map does not extend Collection interface?

Please continue reading at https://agrawalsuneet.github.io/blogs/why-map-does-not-extend-collection-interface/

That’s all for now. You can read my other interesting posts here or you can enjoy my games or apps listed here. Feel free to use my open-source Android components in your app listed here. Or drop an email, if you didn’t find what you are looking for and need some help.

--

--