简体   繁体   中英

Dynamic HashMap in Android for search

We were designing an android app for a competition. I was trying to improvise on the features by trying to have a temporary cache on the app. I was going to use HashMap for this purpose. However, I was wondering if there is any special way of creating dynamic hashMap. If yes, please let me know as I am a java noob.(Google did not help much) As of now, i am using the normal declaration for hashMap.(I'm sure that's not right though).

JVM takes care of memory once an application as been terminated. Memory will automatically be free'd up after you exit the program.

Now, if you want to dump the hash map to a file, that's a different story, since HashMap implements Serializable, you can dump the object bytes to a file before the app exits, and load it back in when it starts back up.

Decent write up on Serialization:

http://java.sun.com/developer/technicalArticles/Programming/serialization/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM