import java.io.IOException; public class StockTracker { Map151Impl positions; public StockTracker() { positions = new Map151Impl<>(); } public void track(String filename) { ReadCSV csvReader; try { csvReader = new ReadCSV(filename, 4000); } catch (IOException ioe) { System.err.println("Ending. Cannot read. " + ioe.toString()); return; } for (String[] datum : csvReader) { int newamt = Integer.parseInt(datum[1]); Integer oldVal = positions.get(datum[0]); if (oldVal != null) newamt += oldVal; positions.put(datum[0], newamt); } System.out.println(positions); } public static void main(String[] args) { StockTracker st = new StockTracker(); st.track("./trades.txt"); } }