[jboss-cvs] jboss-cvs-commits Digest, Vol 37, Issue 460
David M. Lloyd
david.lloyd at redhat.com
Tue Jul 28 15:22:24 EDT 2009
On 07/28/2009 02:15 PM, David M. Lloyd wrote:
> On 07/28/2009 01:37 PM, Ales Justin wrote:
>> > + /**
>> > + * Get the all the parent files of this virtual file from this
>> file to the root. The leafmost file will be at
>> > + * the start of the array, and the rootmost will be at the end.
>> > + *
>> > + * @return the array of parent files
>> > + */
>> > public VirtualFile[] getParentFiles() {
>> > return getParentFiles(0);
>>
>> I think this would better be LinkedList or something "not array".
>> To be able to do getFirst() or getLast() easily.
>
> If you want just the root, use VFS.getRoot(); if you want the last parent,
> virtualFile.getParent(). For all other uses, nothing will outperform the
> array in terms of access speed and memory overhead. If one wants a list,
> wrapping Arrays.asList() is the best choice (though I can see having a
> variant which returns a List which does exactly this). LinkedList is a
> stinker performance-wise.
I added a getParentFileList() convenience method that does exactly that.
- DML
More information about the jboss-cvs-commits
mailing list