I want to prepare a HashMap
in such way that
Key : Country Code
Value : List of returned orderEntries
the following process data method process every 5 orderEntry
which can be from any country.
let me make it more clear. I have list of orderEntries
that come from different countries now I want to put these entries into map
based on country key. Like if 20 entries coming from US
then US
will be the key and 20 Entries would be the values. But problem is that I don't want to create a list for each county inside map
.
public void processSegmentData(final List resultSet)
{
for (final Object orderEntry : resultSet)
{
if (orderEntry instanceof OrderEntryModel)
{
String countryCode = null;
final OrderModel order = ((OrderEntryModel) orderEntry).getOrder();
if (order.getDeliveryAddress() != null)
{
countryCode = order.getDeliveryAddress().getCountry().getIsocode();
}
orderEntriesMap.put(Config.getParameter(countryCode+".return.pid"), orderEntries);
}
}
}