There is a library for storing key-value , Hawk .
If I have for example: List<Animal> animals , which is filled with elements:
animals.add(new Horse()); animals.add(new Cat()); animals.add(new Dog()); I save it in Hawk , and when I take it back, all the animals are saved of the desired type, but if I have a Box object containing a List<Animal> animals and I save it, then I will have a list from Animal that I cannot convert in Horse , etc ..