dcsimg
Paging, How to do this?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Aad_Nales
Posted On:   Wednesday, April 16, 2003 05:22 AM

In the problem I am working on I use LinkedHashMap extensively to store the results of database queries. The results are parsed into beans that are stored under there Primary Key value. When I am browsing through the results I display the results one by one. For usability reasons I need to add a next and a previous button on each page. What I am now struggling with is how to get the next and the previous item from a random element in the list It seems that the LinkedHashMap should be able to get a previous and next easily since the order is maintained in a linked list, however no API seems to exist to get a previous or a next element based on the key value Did anybody ever encounter this and solve it?    More>>

In the problem I am working on I use LinkedHashMap extensively to store the results of database queries. The results are parsed into beans that are stored under there Primary Key value. When I am browsing through the results I display the results one by one.


For usability reasons I need to add a next and a previous button on each page. What I am now struggling with is how to get the next and the previous item from a random element in the list


It seems that the LinkedHashMap should be able to get a previous and next easily since the order is maintained in a linked list, however no API seems to exist to get a previous or a next element based on the key value


Did anybody ever encounter this and solve it?



Cheers,

Aad

   <<Less

Re: Paging, How to do this?

Posted By:   Benoit_Quintin  
Posted On:   Wednesday, April 16, 2003 01:55 PM

Well, you can get an iterator through the keys or values, but that wouldn't let you move back and forth from any given point, I'm afraid...


You might be able to get the keys as a Set, get the set's array and move from there, but that'd be resource intensive.

About | Sitemap | Contact