From f51f6da7319787348c38b875652b5c0e9f88c8aa Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:43:13 -0400 Subject: Cleanup pass Pass to do some cleanups --- .../java/bjc/data/internals/BoundListHolder.java | 50 ++++++++++++++-------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'src/main/java/bjc/data/internals/BoundListHolder.java') diff --git a/src/main/java/bjc/data/internals/BoundListHolder.java b/src/main/java/bjc/data/internals/BoundListHolder.java index 8f8cab4..1193c8d 100644 --- a/src/main/java/bjc/data/internals/BoundListHolder.java +++ b/src/main/java/bjc/data/internals/BoundListHolder.java @@ -21,48 +21,58 @@ public class BoundListHolder implements IHolder { * Create a new list of holders. * * @param toHold - * The list of holders to, well, hold. + * The list of holders to, well, hold. */ public BoundListHolder(final IList> toHold) { heldHolders = toHold; } @Override - public IHolder bind(final Function> binder) { - if(binder == null) throw new NullPointerException("Binder must not be null"); + public IHolder + bind(final Function> binder) { + if (binder == null) + throw new NullPointerException("Binder must not be null"); - final IList> boundHolders = heldHolders.map((containedHolder) -> { - return containedHolder.bind(binder); - }); + final IList> boundHolders + = heldHolders.map(containedHolder -> { + return containedHolder.bind(binder); + }); return new BoundListHolder<>(boundHolders); } @Override - public Function> lift(final Function func) { - if(func == null) throw new NullPointerException("Function to lift must not be null"); + public Function> + lift(final Function func) { + if (func == null) + throw new NullPointerException("Function to lift must not be null"); - return (val) -> { + return val -> { return new ListHolder<>(func.apply(val)); }; } @Override - public IHolder map(final Function mapper) { - if(mapper == null) throw new NullPointerException("Mapper must not be null"); + public IHolder + map(final Function mapper) { + if (mapper == null) + throw new NullPointerException("Mapper must not be null"); - final IList> mappedHolders = heldHolders.map((containedHolder) -> { - return containedHolder.map(mapper); - }); + final IList> mappedHolders + = heldHolders.map(containedHolder -> { + return containedHolder.map(mapper); + }); return new BoundListHolder<>(mappedHolders); } @Override - public IHolder transform(final UnaryOperator transformer) { - if(transformer == null) throw new NullPointerException("Transformer must not be null"); + public IHolder + transform(final UnaryOperator transformer) { + if (transformer == null) + throw new NullPointerException("Transformer must not be null"); - heldHolders.forEach((containedHolder) -> { + heldHolders.forEach(containedHolder -> { containedHolder.transform(transformer); }); @@ -70,8 +80,10 @@ public class BoundListHolder implements IHolder { } @Override - public UnwrappedType unwrap(final Function unwrapper) { - if(unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); + public UnwrappedType + unwrap(final Function unwrapper) { + if (unwrapper == null) + throw new NullPointerException("Unwrapper must not be null"); /* * @NOTE Is there another way we could want to do this? -- cgit v1.2.3