title: Ordered List Map implementation in Java
body: <p>I was wondering if there is a class out there that implements both the <code>Map</code> and <code>List</code> interfaces in Java. </p>
  
  <p>I have a data structure that is primarily a <code>Map</code>. I map strings (IDs) to <code>Image</code>s. But in a specific part of my code, I need to present the user with all the available IDed <code>Images</code>. The only way to do that so far is to write this:</p>
  
  <pre><code>for (String id : myMap.keySet()) {
      // get the image like this "myMap.get(id)" 
  }
  </code></pre>
  
  <p>So it would be nice to have a class that implements both <code>Map</code> and <code>List</code> so I could simply write:</p>
  
  <pre><code>for (Image img : myMap) {
    // the image is img
  }
  </code></pre>
  
  <p>Does anyone know of such an implementation?</p>
  
  <p><strong>EDIT</strong>: After viewing the answers (which are all correct, voted up), I now realize I would also need the map to be sorted. When I say "sorted", all I mean is that I would like it to have the values in a specific order, one that I would be able to modify. I know this is not the original question, but I just realized that I need that.</p>
  
  <p><strong>EDIT 2</strong>: It seems I am indecisive. What I need is an ordered map, not a sorted one. Sorry for the confusion, people.</p>