Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You're being a bit ambiguous about what you want. If you want to lookup a value based on a given key, then store the pairs in a <a href="http://download.oracle.com/javase/6/docs/api/java/util/HashMap.html" rel="nofollow">HashMap</a> (faster) or <a href="http://download.oracle.com/javase/6/docs/api/java/util/Hashtable.html" rel="nofollow">Hashtable</a> (slower but thread-safe). </p> <p>Primitive arrays (and more advanced <a href="http://download.oracle.com/javase/6/docs/api/java/util/List.html" rel="nofollow">List</a>-based collections such and <a href="http://download.oracle.com/javase/6/docs/api/java/util/ArrayList.html" rel="nofollow">ArrayList</a> or <a href="http://download.oracle.com/javase/6/docs/api/java/util/Vector.html" rel="nofollow">Vector</a>) don't work with name-value pairs out of the box. They are simply, well... lists. Primitive arrays can offer a bit more performance, since you avoid creating objects, but the more advanced List-type collections can be safer and more flexible. </p> <p>Still, it sounds (?) like you want a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Map.html" rel="nofollow">Map</a> type collection rather <a href="http://download.oracle.com/javase/6/docs/api/java/util/List.html" rel="nofollow">List</a> type one.</p> <p><strong>UPDATE</strong>: By the way, if you use a Map then you can still work with a list of all your "rId" values. It will be a <a href="http://download.oracle.com/javase/6/docs/api/java/util/Set.html" rel="nofollow">Set</a> datatype actually, but that's just a special cousin of List that doesn't allow duplicates:</p> <pre><code>Map&lt;String, String&gt; myMap = new HashMap&lt;String, String&gt;(); myMap.put("rId11","image3"); // ... additional put's for the other values Set&lt;String&gt; myRids = myMap.keySet(); for(String rId : myRids) { // do whatever you want with each rId one-by-one, etc // You could also use "myRids.iterator()" to work with an Iterator instead } </code></pre>
 

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