Why Map does not extend Collection interface?
Collections in any language is an interface that stores similar data type objects and provides an iteration functionality. The common extensions of Collection are
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.
Iterable interface which is extended by
Collection is further extended by
Set which has their different-different implementations but the unique thing notice is that the Map interface doesn’t extend