package remonsinnema.blog.fizzbuzz;

import java.util.Arrays;
import java.util.Collection;


public class FizzBuzz {

  private final Collection<Term> terms = Arrays.asList(new Term(3, "Fizz"), new Term(5, "Buzz"));

  public String get(int n) {
    StringBuilder result = new StringBuilder();
    for (Term term : terms) {
      term.textFor(n)
          .ifPresent(t -> result.append(t));
    }
    if (result.length() > 0) {
      return result.toString();
    }
    return Integer.toString(n);
  }

}

@@ -88,16 +88,44 @@
 ction;%0D%0A
+import java.util.Optional;%0D%0A
 %0D%0A%0D%0Apubl
@@ -286,89 +286,51 @@
     
-StringBuilder result = new StringBuilder
+return terms.stream
 ()
-;
 %0D%0A    
-for (Term term : terms) %7B%0D%0A     
+    .map(term -%3E
  ter
@@ -341,20 +341,19 @@
 xtFor(n)
+)
 %0D%0A
-  
         
@@ -357,133 +357,115 @@
    .
-ifPresent(t -%3E result.append(t));
+filter(Optional::isPresent)
 %0D%0A    
-%7D%0D%0A
     
-if (result.length() %3E 0) %7B%0D%0A      return result.toString();
+.map(o -%3E o.get())%0D%0A        .reduce((a, b) -%3E a + b)
 %0D%0A    
-%7D%0D%0A
     
-return 
+.orElse(
 Inte
@@ -479,16 +479,17 @@
 tring(n)
+)
 ;%0D%0A  %7D%0D%0A

Use streams instead of loops and conditionals