i want to compare the retrieved file extension with different valid extionsions according to my requirement in java like,
CSVReader reader1 = new CSVReader(reader), ';', '\'', 1);
try{
while ((lNextLine = reader.readNext()) != null) {
for(int i = 0;i < lNextLine.length; i++){
String lFilename = lNextLine[0];
String[] lext = lFilename.split("\\.");
if(lext[1].equals("jpeg")||lext[1].equals("wmv")||lext[1].equals("doc")....){
return true;
}
else{
return false;
}
}
}
}
Thanks,
Raj
Store all the extensions you want to check against in a
static HashSetand then usecontains(...)which is a O(1) operation.