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
Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

How to retrieve data from large collections of objects

Hi,

 

I am having Vector which has 5000 strings,When i type some thing in the editField,I should compare 5000 Sttring elements,and retreive it.How can i do it using RIM API's for bettter speed?

 

Regards

Rakesh shankar.P

Developer
Posts: 1,006
Registered: ‎05-22-2009
My Device: Not Specified

Re: How to retrieve data from large collections of objects

I have to search whether String is there in the data,return abt it

Developer
Posts: 208
Registered: ‎08-04-2009
My Device: Not Specified

Re: How to retrieve data from large collections of objects

[ Edited ]

See keywordfilterdemo Bundeled with JDE or Eclipse Plugin.

Developer
Posts: 16,997
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to retrieve data from large collections of objects

i would suggest to use a different data structure.
afaik a patricia tree would be well suited for this task.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 729
Registered: ‎05-04-2011
My Device: 9700

Re: How to retrieve data from large collections of objects

I agree with simon_hain on changing the data structure.

 

If you must use a Vector, consider using a SimpleSortingVector:

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/util/SimpleSortingVector.html

 

This way you will hold the data sorted and search will be done with O(logn) rather than O(n).

 

E.

Developer
Posts: 723
Registered: ‎03-12-2009
My Device: Playbook

Re: How to retrieve data from large collections of objects

I would look into using BigSortedReadableList

http://www.blackberry.com/developers/docs/5.0.0api/net/rim/device/api/collection/util/BigSortedReada...

It does exactly what you need and it fits extremely well into listfield/search paradigm.