From ba07771f8333f1b098ab8a9ec9fec886b72b9cc0 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Wed, 13 Apr 2016 16:54:12 -0400 Subject: Removed old data types --- BJC-Utils2/src/main/java/bjc/utils/data/Pair.java | 104 ---------------------- 1 file changed, 104 deletions(-) delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/data/Pair.java (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 deleted file mode 100644 index 87727be..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java +++ /dev/null @@ -1,104 +0,0 @@ -package bjc.utils.data; - -import java.util.function.BiConsumer; -import java.util.function.BiFunction; - -/** - * Holds a pair of values of two different types. - * - * Is an eager variant of {@link IPair} - * - * @author ben - * - * @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 implements IPair { - /** - * The left value of the pair - */ - protected L leftValue; - - /** - * The right value of the pair - */ - protected R rightValue; - - /** - * 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. - */ - public Pair(L left, R right) { - leftValue = left; - rightValue = right; - } - - /* - * (non-Javadoc) - * - * @see bjc.utils.data.IPair#doWith(java.util.function.BiConsumer) - */ - @Override - public void doWith(BiConsumer action) { - if (action == null) { - throw new NullPointerException("Action must be non-null"); - } - - action.accept(leftValue, rightValue); - } - - /* - * (non-Javadoc) - * - * @see bjc.utils.data.IPair#merge(java.util.function.BiFunction) - */ - @Override - public E merge(BiFunction merger) { - if (merger == null) { - throw new NullPointerException("Merger must be non-null"); - } - - return merger.apply(leftValue, rightValue); - } - - @Override - public String toString() { - String leftValueString; - - if (leftValue != null) { - leftValueString = leftValue.toString(); - } else { - leftValueString = "(null)"; - } - - String rightValueString; - - if (rightValue != null) { - rightValueString = rightValue.toString(); - } else { - rightValueString = "(null)"; - } - - return "pair[l=" + leftValueString + ", r=" + rightValueString - + "]"; - } - - @Override - public IPair bind( - BiFunction> binder) { - return binder.apply(leftValue, rightValue); - } -} -- cgit v1.2.3