mapDb store list object in off heap or file

663 Views Asked by At

I want to use mapDb to store List object syntax wise not throwing any error, but after getting data for map getting class cast exception. but I do see below warnings in eclipse: Multiple markers at this line

  • Type safety: The expression of type HTreeMap needs unchecked
    conversion to conform to ConcurrentMap>.
  • Type safety: The expression of type GroupSerializer needs unchecked
    conversion to conform to Serializer.
  • Type safety: Unchecked invocation hashMap(String, GroupSerializer, GroupSerializer) of the generic method hashMap(String, Serializer, Serializer) of type DB.

below is the code.

DB db = DBMaker.fileDB("file.db").fileMmapEnable().make();
ConcurrentMap<String,List<Employee>> map = db.hashMap("map", Serializer.STRING, Serializer.JAVA).createOrOpen();
List<Employee> employees = new ArrayList<Employee>(); 
map.put("2019_JAN", employees );
map.put("2019_FEB", employees ); 
db.commit();
db.close();

not use where I am doing wrong, your inputs will be valuable

0

There are 0 best solutions below