Looking to reorder a Map
<p>I have a java Map</p>

<pre><code>Map&lt;String, Attributes&gt;
</code></pre>

<p>String will be an application name, and attributes will be the attributes associated. (Attributes is a custom type).  I need to reorder this Map based on user subscriptions.  I am thinking along the lines of</p>

<ol>
<li>finding the applications the user has subscribed to</li>
<li>creating another Map</li>
<li>looking for each of these applications in the original Map and copying the values to the new Map in the new order</li>
</ol>

<p>Can someone help me as to how to implement this?  And even if this is the best way to tackle this?</p>

<p>Many thanks!</p>

<p>Ok adding an edit to clarify some of the comments.</p>

<p>The original map holds all of the available apps, it will look something like:</p>

<pre><code>"app1", "attribute1, attribute2, attribute3"
"app2", "attribute1, attribute2, attribute3"
"app3", "attribute1, attribute2, attribute3"
"app4", "attribute1, attribute2, attribute3"
</code></pre>

<p>If a user has subscribed to app2 and app4, I want to reorder it to:</p>

<pre><code>"app2", "attribute1, attribute2, attribute3"
"app4", "attribute1, attribute2, attribute3"
"app1", "attribute1, attribute2, attribute3"
"app3", "attribute1, attribute2, attribute3"
</code></pre>

<p>so that their subscribed apps are at the top of the list (the list is used to populate a Spring JSP page).  So when a user sees the page of apps, they can first see what they have and below what else is available.</p>
