BlackBerryForums.com : Your Number One BlackBerry Community
     

»Sponsored Links


BlackBerryApps.com Best Sellers



Reply
 
LinkBack Thread Tools
  (#1 (permalink)) Old
doni49 Offline
Thumbs Must Hurt
 
Posts: 82
Join Date: Aug 2009
Model: Tour
PIN: N/A
Carrier: Verizon
Default Hashtable of Custom Objects--Search through the Hashtable for Objects with Spec Value - 10-20-2009, 03:10 PM

I have a class defined:

Code:
class Transaction{
  private int _id;
  private int _parent;
  private int _account;
  private double _amount;

  //I'm not going to show them all here for space reasons, but
  //I do have all the "setters", "getters" & constructors etc that I need
}
Then I have a hashtable that has all the Transaction objects. I'm trying to figure out a way to search through the Hashtable and return all the transactions with "account" = X (X could be any integer).

Could someone offer some advice as to how I can accomplish this? or if you have a better solution, I'm open to that as well. This app is still in its infancy.

TIA!

P.S. I meant to mention that I originally developed this setup based on my experiences with PHP and MySQL. But it dawned on me last night that I don't have the same search capabiites here. And no--I don't want to connect to the MySQL server to do the searches.


Don

Handspring Visor -> Handspring Visor Deluxe -> Palm Treo 650 on VZW -> Palm Treo 700p on VZW -> Blackberry Tour 9360 on VZW

Last edited by doni49 : 10-20-2009 at 03:22 PM.
   
Reply With Quote
Sponsored Links
Please Login or Register to Remove these Advertisements!

  (#2 (permalink)) Old
Dougsg38p Offline
CrackBerry Addict
 
Posts: 799
Join Date: Mar 2008
Location: Austin, TX
Model: 8320
PIN: N/A
Carrier: T-Mobile
Default 10-20-2009, 05:47 PM

I guess the quick answer is to get an Enumeration of the hashtable, and search through the table looking for you values.

If the table is very large, you might want to look at using SimpleSortingVector to hold the key values, and use this to perform a binary search.
   
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright © 2004-2009 BlackBerryFAQ.com, BlackBerryForums.com.
The names RIM © and BlackBerry © are registered Trademarks of Research In Motion Limited.