Hi Does it make sense to add a hasFiles/isEmpty method to Directory which will return true if the Directory has any files? Today, if someone needs to know that (like me :)), he has to call listAll().length > 0. But listAll() can be a bit expensive for this sort of request.
If it makes sense, then in order for Directory to still be back-compat we can implement it by calling listAll().length > 0, however provide a more efficient implementations in sub-classes. I've checked and it looks like all sub-classes can implement it very efficiently. Also, Directory.listAll()'s contract is not clear - what should it return if it's empty - null or String[0]? I think it'd be good if we specify it, though the specification itself might break back-compat with existing Directory implementations. None of the out-of-the-box ones (all seem to return an empty array), but perhaps apps-specific implementations. I can create an issue and post a patch if it makes sense (and interests anyone). Shai