The List<Pack>
in your HashMap
s are never defined. They are of the interface
list but nowhere you identify what kind of List
they are. You have to follow a structure as follows:
Map<long, List<Pack>> map = new HashMap<>() // java 7 syntax
List<Pack> packets = new ArrayList<>();
packets.add(pack);
map.put(msg.getAck(), packets);
When adding an element to the ´List´, which you now can because it exists, you do:
map.get(msg.getAck()).add(pack);
1
solved HashMap of ArrayList as the value initialization