Search technique using for J2ME Enumeration

Whats the best search technique to use to loop through an Enumeration instance which contains 100 or so Contact objects from the JSR-75 PIM API.

http://www.j2medev.com/api/pim/javax/microedition/pim/Contact.html

References to URLs are useful. Thanks!
meinnitAsked:
Who is Participating?
 
bgloddeCommented:
With only 100 Contacts, I'd just loop the enumeration and compare the relevant search terms against the various parts of the Contact.
0
 
WilliamFrantzCommented:
If you are doing multiple searches, read the enumeration into an array, sort it, and use a binary search algorithm.  It's much faster than repeatedly looping through the content.

http://en.wikipedia.org/wiki/Binary_search

If you are only doing one search, then don't bother.  Just loop through sequentially.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.