Two Laptop Bag*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Regarding the methods in the ServletConfig Interface Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Regarding the methods in the ServletConfig Interface" Watch "Regarding the methods in the ServletConfig Interface" New topic
Author

Regarding the methods in the ServletConfig Interface

ragi singh
Ranch Hand

Joined: Mar 10, 2010
Posts: 198

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

Joined: Mar 10, 2010
Posts: 198

Please explain with an example.
Abimaran Kugathasan
Ranch Hand

Joined: Nov 04, 2009
Posts: 2066

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.


|BSc in Electronic Eng| |SCJP 6.0 91%| |SCWCD 5 92%|
Malatesh Karabisti
Ranch Hand

Joined: Jul 28, 2010
Posts: 153

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Regarding the methods in the ServletConfig Interface
 
Similar Threads
Diff between getInitParameter() in ServletConfig.& ServletContext
ServletContext and ServletConfig
Servlet's "configuration" parameters
getInitParameter()
deviation in the return type of getParameterValues() method