From 848dc739becfa41193aff9a07c918aed91e5ef79 Mon Sep 17 00:00:00 2001 From: bjculkin Date: Fri, 7 Apr 2017 08:56:27 -0400 Subject: Cleanup --- BJC-Utils2/src/main/java/bjc/utils/data/IPair.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java index 24e0381..2dbd141 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java @@ -68,8 +68,7 @@ public interface IPair extends Bifunctor IPair, IPair> combine( IPair otherPair) { - return combine(otherPair, (left, otherLeft) -> new Pair<>(left, otherLeft), - (right, otherRight) -> new Pair<>(right, otherRight)); + return combine(otherPair, Pair::new, Pair::new); } /** @@ -113,8 +112,11 @@ public interface IPair extends Bifunctor Function, Bifunctor> fmapLeft( Function func) { return (argumentPair) -> { - if(!(argumentPair instanceof IPair)) throw new IllegalArgumentException( - "This function can only be applied to instances of IPair"); + if(!(argumentPair instanceof IPair)) { + String msg = "This function can only be applied to instances of IPair"; + + throw new IllegalArgumentException(msg); + } IPair argPair = (IPair) argumentPair; @@ -127,8 +129,11 @@ public interface IPair extends Bifunctor func) { return (argumentPair) -> { - if(!(argumentPair instanceof IPair)) throw new IllegalArgumentException( - "This function can only be applied to instances of IPair"); + if(!(argumentPair instanceof IPair)) { + String msg = "This function can only be applied to instances of IPair"; + + throw new IllegalArgumentException(msg); + } IPair argPair = (IPair) argumentPair; -- cgit v1.2.3