0

I have implement pagination in javamail using getMessages(start ,end) method

.But this method doesn't take sort term as parameters as getSortedMessages(SortTerm term) method take ,

also getSortedMessages method doesn't take range numbers as parameters .

So how I can implement pagination and sorting both together .

I don't want to get all messages and then sort them , this will lead to bad performance in my application.

Any help please ...

HADEV
  • 437
  • 8
  • 19

1 Answers1

1

The getMessages method and the getSortedMessages method don't return the data for the message, they only return the message number from the server, so the amount of data returned is very small. It's not until you access the data using the returned Message objects that the data is fetched from the server. You can also prefetch much of the data in bulk to reduce overhead using the Folder.fetch method.

Bill Shannon
  • 29,579
  • 6
  • 38
  • 40