• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Nested Interface

 
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

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?

  • Kindly help,
     
    (instanceof Sidekick)
    Posts: 8791
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    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.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic