Source:
<code>private SortedMap<Long, List<CircuitStatistics>> parseCSV(String csvStatistics) throws IllegalArgumentException, IOException { CSVReader reader = new CSVReader(new StringReader(csvStatistics)); try { SortedMap<Long, List<CircuitStatistics>> circuitsStatistics = new TreeMap<Long, List<CircuitStatistics>>(); List<String[]> records = reader.readAll(); log.debug("Storing the new " + records.size() + " received circuits statistics."); for (String[] currentRecord : records) { if (currentRecord.length != 7) throw new IllegalArgumentException("Invalid record length: it should contain 7 fields."); CircuitStatistics currentStatistics = new CircuitStatistics(); if (!StringUtils.isNumeric(currentRecord[0].trim())) throw new IllegalArgumentException("Records should start with timestamp."); Long timestamp = Long.valueOf(currentRecord[0].trim()); currentStatistics.setSlaFlowId(currentRecord[1].trim()); currentStatistics.setThroughput(currentRecord[2].trim()); currentStatistics.setPacketLoss(currentRecord[3].trim()); currentStatistics.setDelay(currentRecord[4].trim()); currentStatistics.setJitter(currentRecord[5].trim()); currentStatistics.setFlowData(currentRecord[6].trim()); <START> if (circuitsStatistics.keySet().contains(timestamp)) <END> circuitsStatistics.get(timestamp).add(currentStatistics); else { List<CircuitStatistics> circuitStatisticsList = new ArrayList<CircuitStatistics>(); circuitStatisticsList.add(currentStatistics); circuitsStatistics.put(timestamp, circuitStatisticsList); } } return circuitsStatistics; } finally { reader.close(); } }</code><technical_language>I circuitsStatistics.containsKey(timestamp) faster (and easier read)</technical_language>

Target:
private SortedMap<Long, List<CircuitStatistics>> parseCSV(String csvStatistics) throws IllegalArgumentException, IOException { CSVReader reader = new CSVReader(new StringReader(csvStatistics)); try { SortedMap<Long, List<CircuitStatistics>> circuitsStatistics = new TreeMap<Long, List<CircuitStatistics>>(); List<String[]> records = reader.readAll(); log.debug("Storing the new " + records.size() + " received circuits statistics."); for (String[] currentRecord : records) { if (currentRecord.length != 7) throw new IllegalArgumentException("Invalid record length: it should contain 7 fields."); CircuitStatistics currentStatistics = new CircuitStatistics(); if (!StringUtils.isNumeric(currentRecord[0].trim())) throw new IllegalArgumentException("Records should start with timestamp."); Long timestamp = Long.valueOf(currentRecord[0].trim()); currentStatistics.setSlaFlowId(currentRecord[1].trim()); currentStatistics.setThroughput(currentRecord[2].trim()); currentStatistics.setPacketLoss(currentRecord[3].trim()); currentStatistics.setDelay(currentRecord[4].trim()); currentStatistics.setJitter(currentRecord[5].trim()); currentStatistics.setFlowData(currentRecord[6].trim()); if (circuitsStatistics.containsKey(timestamp)) circuitsStatistics.get(timestamp).add(currentStatistics); else { List<CircuitStatistics> circuitStatisticsList = new ArrayList<CircuitStatistics>(); circuitStatisticsList.add(currentStatistics); circuitsStatistics.put(timestamp, circuitStatisticsList); } } return circuitsStatistics; } finally { reader.close(); } }