I have this piece of code:
Folder fold = Factory.Folder.fetchInstance(os, folderPath, null);
DocumentSet docs = fold.get_ContainedDocuments();
Iterator it = docs.iterator();
Document retr;
try {
while (it.hasNext()) {
retr = (Document)it.next();
String name = retr.get_Name();
System.out.println(name);
if(name.equals(fileName)) {
System.out.println("Match Found");
System.out.println("Document Name : " + retr.get_Name());
return retr;
}
}
} catch (Exception e) {
e.printStackTrace();
}
Currently, this code works fine for retrieving a document with a certain file name. I want to add to this so that it can also select the latest version of the file with that name. What should i do?
I've considered adding an extra if inside the existing one, but i'm afraid of impacting the performance.