posted 14 years ago
You can use this sample code -
The result of this program is {1=Testing, 10=Sample, 20=First, 30=Second}.
In this case I have used Integer as a key to it is giving the result in ascending order by key. But if you are using any other object they you shall have to check that the object has implemented the comparable interface in it
Regards
Salil Verma