I Know its been asked a hundred times, and the answer is always the same, You Can not use multiple repeating values in a hashmap. But lets get to the problem. I have an import file, the import file has information around the lines of a CustomerID, a ProductID, and Units sold (its a basic Receipt format). What I want to do is take the import, put it into a map, and be able to reference it.
Map<integer,DoubleSales> hashmap = new HashMap <integer,DoubleSales>
 try {
Scanner dataFile = new Scanner 9new File ("./salesData.csv"));
dataFile.nextLine();
while(dataFile.hasNextLine()){
String[] lineValues = line.split (",");
Integer CustomerID = Integer.parseInt(lineValues[0]);
Integer ProductID = Integer.parseInt(lineValues[1]);
integer Units = Integer.parseInt(lineValues[2]);
DoubleSales sales = new DoubleSales(CustomerID,ProductID,Units);
ProductData.put(CustomerID,sales);
}
class DoubleSales{
int CustomerID;
int ProductID;
int Units;
DoubleSales(int custID, int prodID, int Units){
CustomerID = custID;
ProductID = prodID;
Units = units;
}
}
The import file has data in the format of
CustomerID, ProductID, UnitsSold
1,10002,3
1,10004,5
1,10008,2
1,10010,3
1,10010,3
Using the code up there, When I print the customerID value of 1, I get just the last entry which is 10010,3.
How would I do it to print out, all values of CustomerID 1, and the Units sold?
for example:
1,10002,3
  10004,5
  10008,2
  10010,3
  10010,3 
(will add the two 10010 values later.)
I do not wish to Use array lists.




