So guys i finally found the best solutions i guess to read and import data from my Tab-separated file using openCSV library, and it goes well for all types of CSV file (Character separated value) with titles, we have just to change the separator. Here is the code:
File xlsFile = new File(path);
CSVReader reader = new CSVReader(new FileReader(xlsFile), '\t');
ArrayList data = new ArrayList();
String[] nextLine;
while ((nextLine = reader.readNext()) != null) {
final int size = nextLine.length;
//handle empty lines
if (size == 0) {
continue;
}
String debut = nextLine[0].trim();
if (debut.length() == 0 && size == 1) {
continue;
}
data.add(nextLine);
}
String[] titles = data.get(0);
data.remove(0);
ArrayList> mappedData = new
ArrayList>(data.size());
final int titlesLength = titles.length;
for (String[] oneData : data) {
final Map map = new HashMap
for (int i = 0; i < titlesLength; i++) {
final String key = titles[i];
final String value = oneData[i];
map.put(key, value);
}
mappedData.add(map);
}
And then we have to get values from the mappedData by their keys(titles or columns name in my case)