providence
providence

Reputation: 29463

HashMap in an SQLite Database

I would like to store a HashMap in an SQLite Database. I have tried using an object database, but it's more bulky than I would like for android development. Would I just serialize it and then store the result of serialization? Or must I do something else?

Upvotes: 3

Views: 4472

Answers (2)

Buhake Sindi
Buhake Sindi

Reputation: 89169

Seeing HashMap is a key/value pair, why not add all keys/values to a JSON Object and store the object in SQLite?

Upvotes: 4

duffymo
duffymo

Reputation: 308763

A Map is key/value pairs. If you have a table with a primary key column that matches your Map key you can add one row per Map entry into the database.

Upvotes: 1

Related Questions