Retrieving data from a database and retrieving data from a hash map

In my android * project, I need to track product details of a certain number of products. All data from these products is stored in a SQLite database . I can use select and update in SQLite to track product objects . Therefore, I can store product information when they change. I also can download all the products in a hash map or a data structure at the beginning and keep track of these objects of the product. what matters to me is higher than the one that has a more efficient and productive. Can anybody help me. Thanks!

+4
source share
2 answers

It depends on the quantity of products. HashMap is in RAM, the database is on disk.

It also depends on the number of requests per second and the nature of the requests. Database developers have put a lot of effort into supporting indexing and filtering; if you need it, reuse is better than re-invention.

, , Android (, ), onPause() ( onDestroy() onStop(), . ). , , ( ), , , . , onPause() inSaveInstanceState() ( ) . HashMap .

OTOH, ( , ), ; 10 , , .

: Activity - MVC ( , XML , ). . . . .

+5

. HashMap, , sqlite , , . . Mobile, , , , , , .

. SQLITE Map, , , , , db , . , , .

. , MAP, , - , , .

, DB + MAp, , , , + eleborate, .

+2

All Articles