You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (JIRA)" <ji...@apache.org> on 2017/07/07 16:31:00 UTC

[jira] [Commented] (VFS-638) FileObject.hasChildren()

    [ https://issues.apache.org/jira/browse/VFS-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16078342#comment-16078342 ] 

Gary Gregory commented on VFS-638:
----------------------------------

We welcome patches, with unit tests of course ;-)

> FileObject.hasChildren()
> ------------------------
>
>                 Key: VFS-638
>                 URL: https://issues.apache.org/jira/browse/VFS-638
>             Project: Commons VFS
>          Issue Type: New Feature
>    Affects Versions: 2.1
>            Reporter: Guido Schnepp
>            Priority: Minor
>
> It would be great to get new fail-fast hasChildren() method to dertmine if a FileObject really has Children or not. You often only need to know if a FileObject has minimum one child but don't need to know how many.
> I've tried to simulate this in different ways:
> # fo.getChildren().size() > 0 returns the whole list first and therefore takes some time to get the basic information. Too long for only this information
> # fo.iterator().next() != fo; (iterator returns the original fo as last child again so you need to check if there are other file objects in folder) doesn't work either, because the iterator also collects all children before, many also these from the subfolders.
> # fo.getType().hasChildren() is nothing more than a static flag in an enumeration of types with no real life information
> Many thanks in advance
> Guido



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)