J
Jan Burse
Dear All,
Is there a fast way to have an Enumeration from a HashMap?
I am trying to reimplement the HttpServletRequest interface,
and I am trying to use a HashMap for parameters and attributes.
I guess this is valid when my web application doesn't use
a HttpServletRequest concurrently, right? Or might the web
server populate it concurrently?
Now I am stuck here:
/**
* <p>Retrieve the parameter names.</p>
*
* @return The names.
*/
public Enumeration<String> getParameterNames() {
return parametermap.keys();
}
It requires a Enumeration, but when parametermap is
a HashMap, it will not deliver an Enumeration, but
instead an Iterator via keySet().iterator(). Any fast
way to have an Enumeration nevertheless?
Bye
P.S.:
Other interface methods would allow a migration to
HashMap, for example:
/**
* <p>Retrieve the parameter map.</p>
*
* @return The parameter map.
*/
public Map<String, String[]> getParameterMap() {
return parametermap;
}
Is there a fast way to have an Enumeration from a HashMap?
I am trying to reimplement the HttpServletRequest interface,
and I am trying to use a HashMap for parameters and attributes.
I guess this is valid when my web application doesn't use
a HttpServletRequest concurrently, right? Or might the web
server populate it concurrently?
Now I am stuck here:
/**
* <p>Retrieve the parameter names.</p>
*
* @return The names.
*/
public Enumeration<String> getParameterNames() {
return parametermap.keys();
}
It requires a Enumeration, but when parametermap is
a HashMap, it will not deliver an Enumeration, but
instead an Iterator via keySet().iterator(). Any fast
way to have an Enumeration nevertheless?
Bye
P.S.:
Other interface methods would allow a migration to
HashMap, for example:
/**
* <p>Retrieve the parameter map.</p>
*
* @return The parameter map.
*/
public Map<String, String[]> getParameterMap() {
return parametermap;
}