Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
Posts: 4
Registered: ‎05-07-2010
My Device: Not Specified
My Carrier: TIM

Mail messages in store are ordered?

[ Edited ]

Hello,

  I'm new in this forum. :womanhappy:

 

I need to extract all the messages older than a given date from the Inbox folder.

In order to do that I would do:

 

 

Date myGivenDate = ...
Folder folder = store.getFolder("Inbox");

Message[] messages = folder.getMessages()
for(int i=0; i<messages.length; i++){
  if(messages[i].getReceivedDate() > myGivenDate)
    manage(messages[i]);
}

 

 

I would write something more efficient if I knew that messages are already sorted somehow.

 

I mean: if messages were already sorted I could use a bynary search to reach the point where messages become older than my given date.

 

What do you think about this?

 

Thank you.

 

--

l-/

Lynda
New Contributor
Posts: 4
Registered: ‎05-07-2010
My Device: Not Specified
My Carrier: TIM

Re: Mail messages in store are ordered?

Anybody can help me?

Lynda
New Contributor
Posts: 4
Registered: ‎05-07-2010
My Device: Not Specified
My Carrier: TIM

Re: Mail messages in store are ordered?

It seems that messages are ordered by receiving time.

Lynda