Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6386916

File.list{Files?}(FilenameFilter) use inefficient reflection based array building

XMLWordPrintable

    • b78
    • x86
    • windows_xp

      A DESCRIPTION OF THE REQUEST :
      File.list(FilenameFilter)
      File.listFiles(FilenameFilter)
      File.listFiles(FileFilter)

      all create the resultant list of files using the reflective form of toArray. As these methods are intensive already, seems like this is a silly thing to do.

      Code should be changed to


      return (File[])(v.toArray(new File[v.size()]));


      JUSTIFICATION :
      performance

            jhangalsunw Jayalaxmi Hangal (Inactive)
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: