package remonsinnema.blog.fizzbuzz;

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


public class FizzBuzz {

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

  public String get(int n) {
    StringBuilder result = new StringBuilder();
    for (MultipleReplacer replacer : replacers) {
      Optional<String> replacement = replacer.textFor(n);
      if (replacement.isPresent()) {
        result.append(replacement.get());
      }
    }
    if (result.length() > 0) {
      return result.toString();
    }
    return Integer.toString(n);
  }

}

@@ -321,138 +321,58 @@
     
-StringBuilder result = new StringBuilder();%0A    for (MultipleReplacer replacer : replacers) %7B%0A      Optional%3CString%3E 
+return replacers.stream()%0A        .map(
 replace
-ment =
+r -%3E
  rep
@@ -391,32 +391,36 @@
 r(n)
-;
+)
 %0A      
-if (replacement.
+  .filter(Optional::
 isPr
@@ -428,13 +428,9 @@
 sent
-()) %7B
+)
 %0A   
@@ -438,136 +438,90 @@
     
-result.append(replacement
+.map(optional -%3E optional
 .get())
-;
 %0A      
-%7D%0A    %7D%0A    if (result.length(
+  .reduce((a, b
 ) 
+-
 %3E 
-0) %7B%0A      return result.toString();
+a + b)
 %0A    
-%7D%0A
     
-return 
+.orElse(
 Inte
@@ -535,16 +535,17 @@
 tring(n)
+)
 ;%0A  %7D%0A%0A%7D

Use streams instead of loops and conditionals