title: How to obtain index of a given LinkedHashSet element without iteration?
body: <p>Is it even possible?</p>
  
  <p>Say you have </p>
  
  <pre><code>private Set&lt;String&gt; names = new LinkedHashSet&lt;String&gt;();
  </code></pre>
  
  <p>and <code>Strings</code> are "Mike", "John", "Karen".</p>
  
  <p>Is it possible to get "1" in return to "what's the index of "John" without iteration?</p>
  
  <p>The following works fine .. with this question i wonder if there is a better way</p>
  
  <pre><code>for (String s : names) {
      ++i;
      if (s.equals(someRandomInputString)) {
          break;
      }
  }
  </code></pre>