From 6340caa7ec15be51c6d633a0519f3e0c76b25241 Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 9 Nov 2020 18:53:43 -0500 Subject: Formatting cleanup --- src/main/java/bjc/data/Pair.java | 41 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 25 deletions(-) (limited to 'src/main/java/bjc/data/Pair.java') diff --git a/src/main/java/bjc/data/Pair.java b/src/main/java/bjc/data/Pair.java index 610e89c..ea2f82f 100644 --- a/src/main/java/bjc/data/Pair.java +++ b/src/main/java/bjc/data/Pair.java @@ -22,7 +22,7 @@ public class Pair implements IPair { /** Create a new pair with both sides set to null. */ public Pair() { - + // Do nothing :) } /** @@ -42,8 +42,7 @@ public class Pair implements IPair { @Override public IPair bind( final BiFunction> 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); } @@ -51,8 +50,7 @@ public class Pair implements IPair { @Override public IPair bindLeft(final Function> 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); } @@ -60,8 +58,7 @@ public class Pair implements IPair { @Override public IPair bindRight( final Function> 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); } @@ -84,8 +81,7 @@ public class Pair implements IPair { @Override public IPair mapLeft(final Function 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); } @@ -93,8 +89,7 @@ public class Pair implements IPair { @Override public IPair mapRight(final Function 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)); } @@ -102,8 +97,7 @@ public class Pair implements IPair { @Override public MergedType merge(final BiFunction 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); } @@ -137,26 +131,23 @@ public class Pair implements IPair { @Override public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof Pair)) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (!(obj instanceof Pair)) return false; final Pair other = (Pair) obj; if (leftValue == null) { - if (other.leftValue != null) - return false; - } else if (!leftValue.equals(other.leftValue)) + if (other.leftValue != null) return false; + } else if (!leftValue.equals(other.leftValue)) { return false; + } if (rightValue == null) { - if (other.rightValue != null) - return false; - } else if (!rightValue.equals(other.rightValue)) + if (other.rightValue != null) return false; + } else if (!rightValue.equals(other.rightValue)) { return false; + } return true; } -- cgit v1.2.3