Hi

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?


Thanx
T

Recommended Answers

All 2 Replies

Can we have a look at the code?

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 .. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.