If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
naveensh
Posts: 51
Registered: ‎09-18-2008
My Device: Not Specified

How to compare every items of a two vector(similarfilename).

Hi

 

How to compare two vector item.

 

I need to check for similar filenames

 

if similar filename(dont want to be upload) .

 

if not similar filename (upload)

 

 

Thanks in advance ....

Please use plain text.
Developer
marchywka
Posts: 1,415
Registered: ‎07-30-2008
My Device: Not Specified

Re: How to compare every items of a two vector(similarfilename).

I just discovered the RIM Arrays class here,

 

http://www.blackberry.com/developers/docs/4.0.2api/net/rim/device/api/util/package-summary.html

 

you may be able to use something like this,

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

but I would try to find a way to do all the "real" searching and sorting in the Arrays class which presumably

is native code and doesn't have the Comparator stuff ( which of course is useful but as you can imagine

probalby hard for JVM to execute very quickly).

 

Obviously, with two sorted lists it is easy to find similar objects for closer comparison. In this case, it may be faster

to sort string hashes or millisecond dates rather than object pointers given possible overhead of the comparator

but it would depend on a lot of things too. Oddly enough, RIM even provides a "parallel" argument in Arrays.sort()

to facilitate this [ I was looking for something like a "sort order" array to index an unrelated object array but this works fine too, sometimes even the vendors get something right :smileyhappy: ]

 

Anyway, this would seem to be a good package to think about if you need a small database like system too.

 

 

 

 

 

 

Please use plain text.