issue #335 review changes

This commit is contained in:
Crossy147
2016-02-21 12:10:08 +01:00
parent 80ff7bb217
commit 81e8d354a9
3 changed files with 20 additions and 4 deletions

View File

@@ -1,7 +1,23 @@
package com.iluwatar.monad;
import java.util.Objects;
import java.util.function.Function;
import java.util.function.Predicate;
/**
* The Monad pattern defines a monad structure, that enables chaining operations
* in pipelines and processing data step by step.
* Formally, monad consists of a type constructor M and two operations:
* <br>bind - that takes monadic object and a function from plain object to the
* monadic value and returns monadic value.
* <br>return - that takes plain type object and returns this object wrapped in a monadic value.
* <p>
* In the given example, the Monad pattern is represented as a {@link Validator} that takes an instance
* of a plain object with {@link Validator#of(Object)}
* and validates it {@link Validator#validate(Function, Predicate, String)} against given predicates.
* <p>As a validation result {@link Validator#get()} it either returns valid object {@link Validator#t}
* or throws a list of exceptions {@link Validator#exceptions} collected during validation.
*/
public class App {
/**