How to request.getParameterNames into List of strings?
问题 Is it possible to get request.getParameterNames() as a list of Strings? I need to have it in this form. 回答1: Just construct a new ArrayList wrapping the keyset of the request parameter map. List<String> parameterNames = new ArrayList<String>(request.getParameterMap().keySet()); // ... I only wonder how it's useful to have it as List<String> . A Set<String> would make much more sense as parameter names are supposed to be unique (a List can contain duplicate elements). A Set<String> is also