diff options
| author | bjculkin <bjculkin@mix.wvu.edu> | 2018-02-12 22:44:26 -0500 |
|---|---|---|
| committer | bjculkin <bjculkin@mix.wvu.edu> | 2018-02-12 22:44:26 -0500 |
| commit | ae51c587c53f7ca311e556e3cbd0c5566d6c2843 (patch) | |
| tree | a6bbb0baaa20300ad9949425455ea890c021d046 /base/src/main/java/bjc/utils/funcutils | |
| parent | 32f5da54c628408c96db09d279f3a7ef44b3bd19 (diff) | |
Update
Diffstat (limited to 'base/src/main/java/bjc/utils/funcutils')
| -rw-r--r-- | base/src/main/java/bjc/utils/funcutils/FuncUtils.java | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/base/src/main/java/bjc/utils/funcutils/FuncUtils.java b/base/src/main/java/bjc/utils/funcutils/FuncUtils.java index 4be6d78..2e55a3d 100644 --- a/base/src/main/java/bjc/utils/funcutils/FuncUtils.java +++ b/base/src/main/java/bjc/utils/funcutils/FuncUtils.java @@ -16,19 +16,19 @@ public class FuncUtils { * function. * * @param <A> - * The initial type of the function. + * The initial type of the function. * * @param <B> - * The intermediate type of the function. + * The intermediate type of the function. * * @param <C> - * The terminal type of the function. + * The terminal type of the function. * * @param func - * The function to transform. + * The function to transform. * - * @return - * The function transformed into a unary function returning a function. + * @return The function transformed into a unary function returning a + * function. */ public static <A, B, C> Function<A, Function<B, C>> curry2(final BiFunction<A, B, C> func) { return arg1 -> arg2 -> { @@ -40,13 +40,13 @@ public class FuncUtils { * Do the specified action the specified number of times. * * @param nTimes - * The number of times to do the action. + * The number of times to do the action. * * @param cons - * The action to perform. + * The action to perform. */ public static void doTimes(final int nTimes, final Consumer<Integer> cons) { - for (int i = 0; i < nTimes; i++) { + for(int i = 0; i < nTimes; i++) { cons.accept(i); } } @@ -55,11 +55,13 @@ public class FuncUtils { * Return an operator that executes until it converges. * * @param op - * The operator to execute. + * The operator to execute. * * @param maxTries - * The maximum amount of times to apply the function in an attempt - * to cause it to converge. + * The maximum amount of times to apply the function in an + * attempt to cause it to converge. + * + * @return The requested operator. */ public static <T> UnaryOperator<T> converge(final UnaryOperator<T> op, final int maxTries) { return (val) -> { |
