I want to convert List<ObjectInList> to Map<K, V>
class ObjectInList {
List<Long> listWithLong;
Map<String, Object> dataMap; // there is 'id' key, and i want to use this id as key in map to be converted
}
The new map format is like below
String type; // this type is value of dataMap.
List<Long> contents
each Object in List<Object> can have duplicated type
for example
///////// before converted ////////////
[
{
list: [1,2,3],
dataMap: {
type: "a",
}
},
{
list: [4,5,6],
dataMap: {
type: "b",
}
},
{
list: [7,8],
dataMap: {
type: "a",
}
},
]
///////////// after converted //////////
{
"a": [1,2,3,7,8],
"b": [4,5,6]
}
DateType dataMap;andclass DateType{ private String type}