// Path: src/main/java/com/github/brunodles/javavalidation/matcher/When.java
// public class When {
// 
//     private IntConsumer adder;
// 
//     public When(IntConsumer adder) {
//         this.adder = adder;
//     }
// 
//     /**
//      * @param value a String to be the reference value
//      * @return a {@link StringMatcher}
//      */
//     public StringMatcher when(String value) {
//         return new StringMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Integer to be the reference value
//      * @return a {@link IntegerMatcher}
//      */
//     public IntegerMatcher when(Integer value) {
//         return new IntegerMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Long to be the reference value
//      * @return a {@link LongMatcher}
//      */
//     public LongMatcher when(Long value) {
//         return new LongMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Float to be the reference value
//      * @return a {@link FloatMatcher}
//      */
//     public FloatMatcher when(Float value) {
//         return new FloatMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Double to be the reference value
//      * @return a {@link DoubleMatcher}
//      */
//     public DoubleMatcher when(Double value) {
//         return new DoubleMatcher(value, adder);
//     }
// 
//     /**
//      * @param object a Object to be the reference value
//      * @param <T>    Don't need to worry with this parameter it will be auto inferred by compiler
//      * @return a {@link ObjectMatcher}
//      */
//     public <T> ObjectMatcher<T, ?> when(final T object) {
//         return new ObjectMatcherImpl<T>(object, adder);
//     }
// }
// 
// Path: src/main/java/com/github/brunodles/retrofunctions/IntConsumer.java
// @FunctionalInterface
// public interface IntConsumer {
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param value the input argument
//      */
//     void accept(int value);
// 
// }


import com.github.brunodles.javavalidation.matcher.When;
import com.github.brunodles.retrofunctions.IntConsumer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;

    /**
     * With this you can check if one key have certain error.
     *
     * @param key   the same key used on {@link #add}
     * @param error the error from {@link Errors}
     * @return true if the key contains the error
     */
    @Override
    public boolean contains(String key, int error) {
        Integer errors = errorsFrom(key);
        return (errors & error) == error;
    }

    @Override
    public boolean contains(String key) {
        return errorsFrom(key) != 0;
    }

    @Override
    public List<String> keys() {
        return Collections.unmodifiableList(new ArrayList<>(errorMap.keySet()));
    }

    /**
     * With this you can use a builder to create all errors for one key
     *
     * @param key the key where the errors will be added
     * @return a helper to build the errors {@link When}
     */
// Path: src/main/java/com/github/brunodles/javavalidation/matcher/When.java
// public class When {
// 
//     private IntConsumer adder;
// 
//     public When(IntConsumer adder) {
//         this.adder = adder;
//     }
// 
//     /**
//      * @param value a String to be the reference value
//      * @return a {@link StringMatcher}
//      */
//     public StringMatcher when(String value) {
//         return new StringMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Integer to be the reference value
//      * @return a {@link IntegerMatcher}
//      */
//     public IntegerMatcher when(Integer value) {
//         return new IntegerMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Long to be the reference value
//      * @return a {@link LongMatcher}
//      */
//     public LongMatcher when(Long value) {
//         return new LongMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Float to be the reference value
//      * @return a {@link FloatMatcher}
//      */
//     public FloatMatcher when(Float value) {
//         return new FloatMatcher(value, adder);
//     }
// 
//     /**
//      * @param value a Double to be the reference value
//      * @return a {@link DoubleMatcher}
//      */
//     public DoubleMatcher when(Double value) {
//         return new DoubleMatcher(value, adder);
//     }
// 
//     /**
//      * @param object a Object to be the reference value
//      * @param <T>    Don't need to worry with this parameter it will be auto inferred by compiler
//      * @return a {@link ObjectMatcher}
//      */
//     public <T> ObjectMatcher<T, ?> when(final T object) {
//         return new ObjectMatcherImpl<T>(object, adder);
//     }
// }
// 
// Path: src/main/java/com/github/brunodles/retrofunctions/IntConsumer.java
// @FunctionalInterface
// public interface IntConsumer {
// 
//     /**
//      * Performs this operation on the given argument.
//      *
//      * @param value the input argument
//      */
//     void accept(int value);
// 
// }


// Path: src/main/java/com/github/brunodles/javavalidation/ValidationResultBuilder.java
import com.github.brunodles.javavalidation.matcher.When;
import com.github.brunodles.retrofunctions.IntConsumer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;


    /**
     * With this you can check if one key have certain error.
     *
     * @param key   the same key used on {@link #add}
     * @param error the error from {@link Errors}
     * @return true if the key contains the error
     */
    @Override
    public boolean contains(String key, int error) {
        Integer errors = errorsFrom(key);
        return (errors & error) == error;
    }

    @Override
    public boolean contains(String key) {
        return errorsFrom(key) != 0;
    }

    @Override
    public List<String> keys() {
        return Collections.unmodifiableList(new ArrayList<>(errorMap.keySet()));
    }

    /**
     * With this you can use a builder to create all errors for one key
     *
     * @param key the key where the errors will be added
     * @return a helper to build the errors {@link When}
     */
    public When addTo(String key) {