• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding the methods in the ServletConfig Interface

 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In the ServletConfig Interface we have a method getInitParameterNames() whose signature is
Enumeration getInitParameterNames() , now can anyone explain what does an Enumeration type have to do in the return type of getInitParameterNames() method .
 
ragi singh
Ranch Hand
Posts: 198
Oracle Suse
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please explain with an example.
 
Abimaran Kugathasan
Ranch Hand
Posts: 2066
Clojure IntelliJ IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An enumeration is an object that generates elements one at a time, used for passing through a collection, usually of unknown size. The traversing of elements can only be done once per creation. Here, we use it get the names of the initial parameters, which are unknown in size. It's logically like a Collection, but, in Collection, we have to manipulate the elements manually. But for Enumeration, it will automatically manipulates the elements.

There are lot of examples in the net with other collections.
 
Malatesh Karabisti
Ranch Hand
Posts: 153
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably I think you need some explanation regarding Enumeration, you might have done some coding with Iterator. Enumeration is similar to that Iterator both have purpose of getting each value in the Collection. Just check the below code and the result you will get idea.



Output:
value1
value2
value3

Hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic