commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <>
Subject [jira] [Commented] (VFS-638) FileObject.hasChildren()
Date Fri, 07 Jul 2017 16:31:00 GMT


Gary Gregory commented on VFS-638:

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

> FileObject.hasChildren()
> ------------------------
>                 Key: VFS-638
>                 URL:
>             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

View raw message