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: 50
Registered: ‎02-18-2009
My Device: Not Specified
Accepted Solution

Java Set in RIM API

Hi,

 

I'm wondering if someone can suggest on a proper Set API in BlackBerry, please? I only want to use it to add and get object. Does WritableSet help? Thanks a lot in advance.

Highlighted
Developer
Posts: 1,807
Registered: ‎04-28-2009
My Device: Z10 (STL100-4)-10.3.2.858, Z10 (STL100-3)-10.3.1.2576, Z30 (STA100-5)-10.3.1.2582, Passport (SQW100-1)-10.3.1.2576, PlayBook (16GB)-2.1.0.1917
My Carrier: Verizon

Re: Java Set in RIM API

[ Edited ]

If all you want is add and get, you can use nearly any non-array collection (Vector, and the variety of classes in net.rim.device.api.collection.util). Though they will allow the addition of duplicates unless otherwise said.

---Spends time in #blackberrydev on freenode (IRC)----
Three simple rules:
1. Please use the search bar before making new posts.
2. "Like" posts that you find helpful.
3. If a solution has been found for your post, mark it as solved.
--I code too much. Well, too bad.
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Java Set in RIM API

Just adding to the previous post, WriteableSet Interface is just an interface, I had a quick look and can't find a Collection that implements it.  But you could write your own, based on Vector or another collection. 

Developer
Posts: 50
Registered: ‎02-18-2009
My Device: Not Specified

Re: Java Set in RIM API

thanks for your reply and yes, i want to use a collection with no duplicate item
Developer
Posts: 50
Registered: ‎02-18-2009
My Device: Not Specified

Re: Java Set in RIM API

Yes, it is weird that there is only writeableSet in the API and no class implemented it...

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

Re: Java Set in RIM API

I usually use vector and check if it contains the item i am about to add.
requires you to write proper equals methods in the beans, of course.
----------------------------------------------------------
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: 50
Registered: ‎02-18-2009
My Device: Not Specified

Re: Java Set in RIM API

really appreciate for your reply. I'll try other Collection like Vector.