DirectoryContentsList request method


#1

Hi Jules,

Would you consider adding a method to the DirectoryContentsList that returns the index of a given file? Either

/** Returns true if the list contains the specified file, and also returns its index if
 it was found. */
bool contains (const File&, int& index) const;

or

/** Returns the index of the specified file, or -1 if that file is not in the list.
*/
int indexOf (const File& fileToFind) const;

would do. This would help avoid redundant O(N) searches through large list.


#2

Hmm, not keen on that idea. The way this class works is for it to be continuously updating the list on a thread, so these indexes can’t be relied on to stay constant - I’d rather not encourage people to use them more than necessary.