Velocity
  1. Velocity
  2. VELOCITY-533

Treat arrays like fixed-length lists

    Details

    • Type: New Feature New Feature
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Engine
    • Labels:
      None

      Description

      I'd like to see arrays treated like fixed-length List objects as much as possible. This means auto-magically supporting size(), set(int,Object), get(int), and isEmpty() at a minimum. Support for something like iterator() probably isn't necessary, since #foreach already handles arrays, but it might be good for completeness. These should be possible via some Uberspect hackery.

      And since the goal is to free template authors from having to care about the differences between Lists and arrays, we might also consider supporting conversion between the two for method calls, so:

      $foo.wantsListHere($thisisAnArray)

      and

      $bar.wantsArrayHere($thisisAList)

      both work automatically. I haven't yet looked into what it would take to do this. If it is too hard or messy, i could be happy with just support for calling List methods on arrays.

      1. PrimitiveArrayWrapper.java
        1 kB
        Christopher Schultz
      2. PrimitiveArrayList.java
        0.7 kB
        Christopher Schultz

        Issue Links

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              Nathan Bubna
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development