summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-14 12:07:14 -0400
committerEVE <EVE@EVE-PC>2017-03-14 12:07:14 -0400
commit504ca816530efdff06bc202e0432ebd354aec304 (patch)
tree4836932fb81d1d625470502c78c94d202c9a7420 /BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
parent5c1163df17c46f7d3e15b6c7949c38843ec56146 (diff)
Cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/Pair.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/Pair.java28
1 files changed, 8 insertions, 20 deletions
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 b22fd28..77afa4a 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/Pair.java
@@ -5,7 +5,7 @@ import java.util.function.Function;
/**
* A pair of values, with nothing special about them.
- *
+ *
* @author ben
*
* @param <LeftType>
@@ -29,7 +29,7 @@ public class Pair<LeftType, RightType> implements IPair<LeftType, RightType> {
/**
* Create a new pair with both sides set to the specified values
- *
+ *
* @param left
* The value of the left side
* @param right
@@ -43,9 +43,7 @@ public class Pair<LeftType, RightType> implements IPair<LeftType, RightType> {
@Override
public <BoundLeft, BoundRight> IPair<BoundLeft, BoundRight> bind(
BiFunction<LeftType, RightType, IPair<BoundLeft, BoundRight>> binder) {
- if (binder == null) {
- throw new NullPointerException("Binder must not be null.");
- }
+ if(binder == null) throw new NullPointerException("Binder must not be null.");
return binder.apply(leftValue, rightValue);
}
@@ -53,9 +51,7 @@ public class Pair<LeftType, RightType> implements IPair<LeftType, RightType> {
@Override
public <BoundLeft> IPair<BoundLeft, RightType> bindLeft(
Function<LeftType, IPair<BoundLeft, RightType>> leftBinder) {
- if (leftBinder == null) {
- throw new NullPointerException("Binder must not be null");
- }
+ if(leftBinder == null) throw new NullPointerException("Binder must not be null");
return leftBinder.apply(leftValue);
}
@@ -63,9 +59,7 @@ public class Pair<LeftType, RightType> implements IPair<LeftType, RightType> {
@Override
public <BoundRight> IPair<LeftType, BoundRight> bindRight(
Function<RightType, IPair<LeftType, BoundRight>> rightBinder) {
- if (rightBinder == null) {
- throw new NullPointerException("Binder must not be null");
- }
+ if(rightBinder == null) throw new NullPointerException("Binder must not be null");
return rightBinder.apply(rightValue);
}
@@ -83,27 +77,21 @@ public class Pair<LeftType, RightType> implements IPair<LeftType, RightType> {
@Override
public <NewLeft> IPair<NewLeft, RightType> mapLeft(Function<LeftType, NewLeft> mapper) {
- if (mapper == null) {
- throw new NullPointerException("Mapper must not be null");
- }
+ if(mapper == null) throw new NullPointerException("Mapper must not be null");
return new Pair<>(mapper.apply(leftValue), rightValue);
}
@Override
public <NewRight> IPair<LeftType, NewRight> mapRight(Function<RightType, NewRight> mapper) {
- if (mapper == null) {
- throw new NullPointerException("Mapper must not be null");
- }
+ if(mapper == null) throw new NullPointerException("Mapper must not be null");
return new Pair<>(leftValue, mapper.apply(rightValue));
}
@Override
public <MergedType> MergedType merge(BiFunction<LeftType, RightType, MergedType> merger) {
- if (merger == null) {
- throw new NullPointerException("Merger must not be null");
- }
+ if(merger == null) throw new NullPointerException("Merger must not be null");
return merger.apply(leftValue, rightValue);
}