Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

      Description

      in: org.apache.commons.jxpath.MapDynamicPropertyHandler

      If the following code:
      public String[] getPropertyNames(Object object) {
      Map map = (Map) object;
      String names[] = new String[map.size()];
      Iterator it = map.keySet().iterator();
      for (int i = 0; i < names.length; i++)

      { names[i] = String.valueOf(it.next()); }

      return names;
      }

      could be replaced by:
      public String[] getPropertyNames(Object object) {
      Set keys = ((Map) object).keySet();
      String names[] = new String[keys.size()];
      Iterator it = keys.iterator();
      for (int i = 0; i < names.length; i++)

      { names[i] = String.valueOf(it.next()); }

      return names;
      }

      This would permit to support very special cases where Map.keySet().size() !=
      Map.size() [which, I know, does not conform to the Map API].
      Anyway, in general, it is better to compute the size on the Set we are actually
      using and not on another one related to it...

      Thanks,

      Yann Duponchel.

        Activity

        Yann Duponchel created issue -
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 26853 12341258
        Henri Yandell made changes -
        Project Commons [ 12310458 ] Commons JXPath [ 12310480 ]
        Component/s JXPath [ 12311120 ]
        Affects Version/s Nightly Builds [ 12311648 ]
        Key COM-1106 JXPATH-63
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Henri Yandell made changes -
        Affects Version/s Nightly Builds [ 12311823 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Yann Duponchel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development