How to get most recent date in a Map<Long, Date>?
<p>Hi i need to get the id of the most recent date contained in a <code>Map</code>.</p>

<p>The id is a unique <code>Long</code> number that identifies the date.</p>

<pre><code>Map&lt;Long, Date&gt; mapRetrieveMostRecent= new HashMap&lt;Long, Date&gt;();
</code></pre>

<p>I filled the map in this way:</p>

<pre><code>mapRetrieveMostRecent.put(id, xDate);
</code></pre>

<p>I know that <code>TreeMap</code> can insert automatically objects sorting by date but in my case the dates aren't unique.
Any suggestions?</p>