I have a collection which is the resultset of a sql query.
when i write out the collection (using system.out.println(col)) my collection is in the correct order. -- which is great.

But when i iterate through the collection in order to populate my linkedhashmap, the items are inserted into the linkedhashmap in a different order.

Is there any way to keep the order of the resulset, and put it into the linkedhashmap so i can display it in the corrrect order?


It turns out by some fluke my collection returned the results in the correct order the first time i ran it, subsequent running of the sql statement, proved that the order by clause was not being processed.(We are usiing another companies methods to generate the sql query. their other method which supposed to allow a person to add and order by clause to the sql query is not working.)

Any way, i think if the methods were working correctly my iteration would work.

sorry for wasting your time.

I m leaving it unsolved for now, incase once they fix up the method, it still doesnt work .. :)

This article has been dead for over six months. Start a new discussion instead.