Uploaded image for project: 'Commons IO'
  1. Commons IO
  2. IO-229

FileFilterUtils - add varargs methods for AndFileFilter and OrFileFilter

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.4
    • Fix Version/s: 2.0
    • Component/s: Filters
    • Labels:
      None
    • Environment:

      Java 1.5+

      Description

      I suggest converting the AndFileFilter(IOFileFilter filter1, IOFileFilter filter2) and OrFileFilter(IOFileFilter filter1, IOFileFilter filter2) constructors to use varargs and instead have the signatures AndFileFilter(IOFileFilter... filters) and OrFileFilter(IOFileFilter... filters). The benefit is that new And/OrFileFilters could be created without having to create a list or limit the initial number of filters to two.
      Ex:
      IOFileFilter hiddenNonEmptyTextFileFilter = new AndFileFilter(HiddenFileFilter.HIDDEN, EmptyFileFilter.NOT_EMPTY, new SuffixFileFilter(".txt"));

      If backwards compatibility is an issue, then the varargs constructors could be added alongside the two argument constructors.

        Attachments

        1. varargs-and-or-filters.patch
          7 kB
          Michael Wooten

          Activity

            People

            • Assignee:
              niallp Niall Pemberton
              Reporter:
              mwooten.dev Michael Wooten
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 2h
                2h
                Remaining:
                Remaining Estimate - 2h
                2h
                Logged:
                Time Spent - Not Specified
                Not Specified