public String toString() { StringBuilder stringBuilder = new StringBuilder(); String sep = ""; for (MappedData mdata : data) { stringBuilder.append(sep); stringBuilder.append(mdata.toString()); sep = System.lineSeparator(); } return stringBuilder.toString(); }
public String getKeys() { String result = ""; HashMap<String, String> wordMap = new HashMap<String, String>(); for (MappedData mappedData : data) { wordMap.put(mappedData.getMot(), mappedData.getMot()); } String sep = ""; for (String word : wordMap.keySet()) { result += sep + word; sep = " "; } return result; }
public static MappedDataList createAndFilterFrom(BufferedReader reader, String key) throws IOException { MappedDataList result = new MappedDataList(); String line = null; while ((line = reader.readLine()) != null) { line = line.trim(); if (line.length() > 0) { MappedData mData = MappedData.createFrom(line); if (mData.getMot().equals(key)) { result.add(mData); } } } return result; }