package org.ricardogarfe.katas;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class FizzBuzz {

    private final static int FIZZ_VALUE = 3;
    private final static int BUZZ_VALUE = 5;
    private final static int ZERO_VALUE = 0;

    private final static int DEFAULT_MAX_VALUE = 100;

    private List<Integer> counterList;

    Predicate<Integer> fizzFilter = value -> (value % FIZZ_VALUE == ZERO_VALUE);
    Predicate<Integer> buzzFilter = value -> (value % BUZZ_VALUE == ZERO_VALUE);


    Consumer<Object> printResultConsumer = System.out::println;

    public FizzBuzz() {
        initializeArrayFromMaxValue(DEFAULT_MAX_VALUE);
    }

    public void transformValues() {
        List<String> fizzBuzzResult = counterList.stream().map(this::retrieveFizzBuzz).collect(Collectors.toList());
        fizzBuzzResult.forEach(printResultConsumer);
    }

    /**
     * Non functional result
     *
     * @param value
     * @return
     */
    public String retrieveFizzBuzz(int value) {

        String result = "";

        if (fizzFilter.test(value)) {
            result += "Fizz";
        }
        if (buzzFilter.test(value)) {
            result += "Buzz";
        }
        return result.length() > 0 ? result : Integer.toString(value);
    }

    public void initializeArrayFromMaxValue(int maxCount) {

        counterList = new ArrayList<>();
        IntStream.range(1, maxCount + 1).forEach(counterList::add);
    }
}

@@ -255,36 +255,36 @@
     private 
-final 
 static
+ final
  int FIZZ_VA
@@ -300,36 +300,36 @@
     private 
-final 
 static
+ final
  int BUZZ_VA
@@ -345,37 +345,37 @@
     private 
-final 
 static 
+final 
 int ZERO_VAL
@@ -382,17 +382,16 @@
 UE = 0;%0A
-%0A
     priv
@@ -398,21 +398,21 @@
 ate 
-final 
 static 
+final 
 int 
@@ -514,33 +514,32 @@
 lter = value -%3E 
-(
 value %25 FIZZ_VAL
@@ -550,25 +550,24 @@
 = ZERO_VALUE
-)
 ;%0A    Predic
@@ -601,17 +601,16 @@
 alue -%3E 
-(
 value %25 
@@ -633,17 +633,16 @@
 RO_VALUE
-)
 ;%0A%0A%0A    

Reorder modifiers