prain
asked on
JComboBox Search Question
Hello,
Small things again...
How to check (Search) if a given target token exists in a JComboBox list?. I am trying to find away to do it without looping from 0..getItemCount()
Any suggessions?
Small things again...
How to check (Search) if a given target token exists in a JComboBox list?. I am trying to find away to do it without looping from 0..getItemCount()
Any suggessions?
There isn't another way
You could use a binary search, which would be better than O(n) but that would require your model be sorted
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
>>and u can always use gDefaultComboBoxModel.getI ndexOf() method if that suits
That won't avoid looping of course - it just means that Java will do it instead of you
That won't avoid looping of course - it just means that Java will do it instead of you