Yesterday only I came across a piece of code in which there was an interface declared inside other interface. When I tried that code it seems the inner interface knows nothing about the outer interface's methods and variables.
My questions are:
Then what is the purpose of having such an interface?
It seems Map.Entry is an inner interface of Map interface. What is its use?
That structure was not necessary, but it does show you something about the designer's intent. With the given APIs, the only way you can get an instance of Map.Entry is from a Map, so it made sense to bundle the Map.Entry interface along with the Map interface. I've seen this organization other 3rd party packages, but not very often.
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi