[stringtemplate-interest] Filtering a list

Bogdan Calmac bc4all at gmail.com
Fri Apr 6 12:25:50 PDT 2007


Assume we have a Person object:

public class Person {
  public String name
  public boolean smart
}

and then let's try to print out just the smart people in a list:

<persons: {<if(it.smart)><it.name><endif>}; separator=",">

this would create something like

Bill,,Bob,,,Jim

with empty spaces for the items filtered out. Could you suggest some
elegant manner to do this?

Thanks,

Bogdan Calmac


More information about the stringtemplate-interest mailing list