Re: In which of the following is it efficient to store data ..Vector ,array ,arraylist,hashtable.....
Posted By:
R_C
Posted On:
Tuesday, August 13, 2002 04:06 AM
i like DefaultTableModel, essentially using a vector or object[], as a 2-d array. especially when jdbc used does not have rowsets.
Re: In which of the following is it efficient to store data ..Vector ,array ,arraylist,hashtable.....
Posted By:
Shripal_Meghani
Posted On:
Tuesday, August 13, 2002 02:48 AM
Well, like everyone else is saying, it depends on the way you intend to use it and on the way the data is stored in the Db.
Someone has correctly pointed out the downside and upside of using the thread safe Vector and Hashtable as compared to arraylist and hashmap.
One more piece of information could be a help in deciding the data structure you use, namely what is the organisation of data in the db? Do you have one index? and do you need to access data through that index? Then a hashtable would be a good choice.
Memory considerations should also be there while deciding to use any data structure
Re: In which of the following is it efficient to store data ..Vector ,array ,arraylist,hashtable.....
Posted By:
Gautam_Marwaha
Posted On:
Wednesday, July 10, 2002 05:21 AM
you can also use JDBC rowset which has similar semantics as Resultset except that it is serializable. Data storage shd be pretty efficient as well...
Re: In which of the following is it efficient to store data ..Vector ,array ,arraylist,hashtable.....
Posted By:
Farooq_Makanar
Posted On:
Wednesday, July 10, 2002 02:37 AM
You can use anything amongst Vector ,array ,arraylist,hashtable, hashmap to store the data. But you have to choose it according to your requirement. Vectors and hashtables should only be used when there is the requirement of thread safety bcoz these classes are threadsafe hence they are haevy and time consuming. Otherwise you can use HashMap, arraylist or linked list. One more thing is that while using arraylist you should know the number of elements in advance. You can not change the legth of an array on the fly. Linked list gives serial access. You have to traverse through n-1 nodes to reach the nth node in a linked list.