tipsy / j2html

Java to HTML generator. Enjoy typesafe HTML generation.
https://j2html.com/
Apache License 2.0
765 stars 136 forks source link

Add supplied versions of iff and iffElse. #128

Closed rupert-madden-abbott closed 5 years ago

rupert-madden-abbott commented 6 years ago

This allows the supplied value to be lazily evaluated. Therefore, it can avoid building a part of the page that never ends up being displayed, just like a regular if statement.

iff(!items.isEmpty(), () -> each(items, item -> ...)
tipsy commented 6 years ago

Thanks @rupert654. I'm trying to decide if this is worth it. Did you do any performance testing?