is it possible to get values of LinkedHashMap by index ?
this is my linkedmap (the reason why i mapped it this way because i need to accumulate the amount and quantity for the duplicated chargeType:
Map<String, ChargeType> chargeTypeCol;
return chargeTypeCol = chargeTypeList
.stream().collect(Collectors.toMap(ChargeType::getChargeTypeName,
Function.identity(),
(a, b) -> new ChargeType(a.getId(), b.getChargeTypeName(), a.getAmount() + b.getAmount(), a.getQuantity() + b.getQuantity()),
LinkedHashMap::new));
I have 2 of these LinkedHashMap in my logic. What i am trying to do is to compare if the values (getChargeTypeName, getAmount, getQuantity) is equals between the 2 map. Was wondering if there are any possible way to do like
for(int i = 0; i < chargeTypeList.size(); i++){
for(int j = 0; j < chargeTypeList2.size(); j++){
if(chargeTypeList.get(i).getChargeTypeName.equalsIgnoreCase(chargeTypeList2.get(j).getChargeTypeName)){
//todo something here
}
}
}