Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1178

ArrayUtils.removeAll(Object array, int... indices) should do the clone, not its callers

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4
    • 3.5
    • lang.*
    • None

    Description

      The method ArrayUtils.removeAll(Object array, int... indices) currently sorts the input indices array. Therefore the array needs to be cloned; this is currently done by the callers.

      However the sort is an implementation detail of the method, so should be done by the method itself, not by the callers, which is fragile (easy to overlook when creating a new method) and unnecessary.

      This would also allow the method to be more easily changed to a different implementation that does not need to sort the array (e.g. using BitSet)

      Attachments

        Activity

          People

            pascalschumacher Pascal Schumacher
            sebb Sebb
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: