Skip to content

Instantly share code, notes, and snippets.

@zahlenteufel
Created April 24, 2018 21:31
Show Gist options
  • Save zahlenteufel/29d2e0094bac2ef8c6d8efced23455ba to your computer and use it in GitHub Desktop.
Save zahlenteufel/29d2e0094bac2ef8c6d8efced23455ba to your computer and use it in GitHub Desktop.
Java SafeHtml collector
class xxx {
Collector<SafeHtml, SafeHtmlBuilder, SafeHtml> safeHtmlCollector =
Collector.of(
SafeHtmlBuilder::new,
(BiConsumer<SafeHtmlBuilder, SafeHtml>) SafeHtmlBuilder::append,
(builder1, builder2) -> builder1.append(builder2.toSafeHtml()),
SafeHtmlBuilder::toSafeHtml);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment