Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Just <a href="http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html#ArrayList%28java.util.Collection%29" rel="nofollow noreferrer">construct</a> a new <code>ArrayList</code> wrapping the keyset of the <a href="http://docs.oracle.com/javaee/6/api/javax/servlet/ServletRequest.html#getParameterMap%28%29" rel="nofollow noreferrer">request parameter map</a>.</p> <pre><code>List&lt;String&gt; parameterNames = new ArrayList&lt;String&gt;(request.getParameterMap().keySet()); // ... </code></pre> <p>I only wonder how it's useful to have it as <code>List&lt;String&gt;</code>. A <code>Set&lt;String&gt;</code> would make much more sense as parameter names are supposed to be <strong>unique</strong> (a <code>List</code> can contain duplicate elements). A <code>Set&lt;String&gt;</code> is also exactly what the map's keyset already represents.</p> <pre><code>Set&lt;String&gt; parameterNames = request.getParameterMap().keySet(); // ... </code></pre> <p>Or perhaps you don't need it at all for the particular functional requirement for which you <a href="https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem">thought</a> that massaging the parameter names into a <code>List&lt;String&gt;</code> would be the solution. Perhaps you <em>actually</em> intented to iterate over it in an enhanced loop, for example? That's also perfectly possible on a <code>Map</code>.</p> <pre><code>for (Entry&lt;String, String[]&gt; entry : request.getParameterMap().entrySet()) { String name = entry.getKey(); String value = entry.getValue()[0]; // ... } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload