Issue with sorting with collection in java
<p>I have a hashmap:</p>

<pre><code>HashMap&lt;String,QuoteBean&gt; map = new HashMap&lt;String,QuoteBean&gt;();
</code></pre>

<p>The <code>QuoteBean</code> is a normal bean:</p>

<pre><code>class QuoteBean{
    String symbol;
    BigDecimal price;
    BigDecimal quoteprice;
    //setter and getter methods
}
</code></pre>

<p>Then, I get the values of the map which a collection of <code>QuoteBean</code> objects</p>

<pre><code>Collection obs  =map.values(); //getting all the quoteobjects
List list = new ArrayList(obs); //converted to list
</code></pre>

<p>Then to sort:</p>

<pre><code>Collection.sort(list, new SymbolComparator());
</code></pre>

<p><code>SymolComparator</code> is:</p>

<pre><code>public class SymbolComparator implements Comparator&lt;QuoteBean&gt;{
    String symbol;
    @Override
    public int compare(QuoteBean o1, QuoteBean o2) {
        String symbol1=o1.getProductId().getSymbol();
        String symbol2=o2.getProductId().getSymbol();
        return symbol1.compareTo(symbol2);
    }    
}
</code></pre>

<p>When I execute the code I get an exeception which says cannot convert <code>String</code> to <code>QuoteBean</code> and the exception throws on the first line.</p>
