velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henning P. Schmiedehausen" <>
Subject Re: Clean way to iterate over a distinct set of items?
Date Wed, 05 Oct 2005 13:13:40 GMT
Mike Kienenberger <> writes:

IMHO that is not part of the view logic to find out the set of your
departments. It's part of the business logic. Write a small tool which 
returns a set of departments.

Doing that in Velocity (while it's probably doable) would be the wrong
place to do it.


Set deps = new HashSet();
for (Iterator it = employeeList.iterator(); it.hasNext(); )

return deps;

	Best regards

>I'm looking for a clean way to iterate over a distinct set of items.

>As an example. consider

>#foreach $employee in $employeeList

>where $employee.getDepartment() may or may not return a unique value.

>What I really want to iterate over is the unique set of departments in
>the employee list.


>And this isn't really what I'm trying to do -- the real example is
>much more complicated, and there's no easy way to add a tool to the
>context so that I could have the equivalent of


>To unsubscribe, e-mail:
>For additional commands, e-mail:

Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH        +49 9131 50 654 0

RedHat Certified Engineer -- Jakarta Turbine Development  -- hero for hire
   Linux, Java, perl, Solaris -- Consulting, Training, Development

		      4 - 8 - 15 - 16 - 23 - 42

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message