I don't know what you mean with java trees, but what I can recommend for the type of problem where you have too many files in a directory is not storing your content in a file but in a datastructure in a caching solution like
, but since your question is kind of vague for me, that could totally be what you not want.