I have created function which uses one object list and using that list it created two HashMap
values:
public HashMap<HashMap<Integer, List<String>>, HashMap<Integer, List<Long>>> getIONameAndId(
List<LineItemVO> lineItemVOs) {
HashMap<Integer, List<String>> ioNameMap = new HashMap<>();
HashMap<Integer, List<Long>> ioIdMap = new HashMap<>();
HashMap<HashMap<Integer, List<String>>, HashMap<Integer, List<Long>>> ioData =
new HashMap<>();
List<Long> ioIds = new ArrayList<Long>();
List<String> ioNames = new ArrayList<String>();
for (LineItemVO lineItemVO : lineItemVOs) {
ioIds.add(lineItemVO.getInsertionOrderId());
ioNames.add(lineItemVO.getInsertionOrderName());
}
ioNameMap.put(1, ioNames);
ioIdMap.put(1, ioIds);
ioData.put(ioNameMap, ioIdMap);
return ioData;
}
I want to simplify this function so it gives exact idea what it returns or should I use Map
instead of HashMap
?