From d7648dd32feedd293be253f827d0a9618d53d043 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Sun, 21 Feb 2016 15:40:55 -0500 Subject: Some refactoring of other packages --- BJC-Utils2/src/main/java/bjc/utils/data/Pair.java | 49 ++++++++++++++++------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/Pair.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java b/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java index 14ac52d..11ce79c 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java @@ -5,47 +5,66 @@ import java.util.function.Function; /** * Holds a pair of values of two different types. + * * @author ben * - * @param The type of the thing held on the left (first) - * @param The type of the thing held on the right (second) + * @param + * The type of the thing held on the left (first) + * @param + * The type of the thing held on the right (second) */ public class Pair { + /** + * The left value of the pair + */ public L l; + + /** + * The right value of the pair + */ public R r; /** * Create a new pair that holds two nulls. */ public Pair() { - + } - + /** * Create a new pair holding the specified values. - * @param left The value to hold on the left. - * @param right The value to hold on the right. + * + * @param left + * The value to hold on the left. + * @param right + * The value to hold on the right. */ public Pair(L left, R right) { l = left; r = right; } - + /** * Create a new pair by applying the given functions to the left/right. - * Does not change the internal contents of this pair. - * @param lf The function to apply to the left value. - * @param rf The function to apply to the right value. + * Does not change the internal contents of this pair. + * + * @param lf + * The function to apply to the left value. + * @param rf + * The function to apply to the right value. * @return A new pair containing the two modified values. */ - public Pair apply(Function lf, Function rf) { + public Pair apply(Function lf, + Function rf) { return new Pair(lf.apply(l), rf.apply(r)); } - + /** - * Collapse this pair to a single value. - * Does not change the internal contents of this pair. - * @param bf The function to use to collapse the pair. + * Collapse this pair to a single value. Does not change the internal + * contents of this pair. + * + * @param bf + * The function to use to collapse the pair. * @return The collapsed value. */ public E merge(BiFunction bf) { -- cgit v1.2.3