diff options
| author | bjculkin <bjculkin@WIT-136XG42.wvu-ad.wvu.edu> | 2017-04-07 10:51:31 -0400 |
|---|---|---|
| committer | bjculkin <bjculkin@WIT-136XG42.wvu-ad.wvu.edu> | 2017-04-07 10:51:31 -0400 |
| commit | 63d88eb8db1f7a6d5924ec2a8b7f462373d5ac9a (patch) | |
| tree | 4a7c67b23c8e1ecb1b2f992e5dbaf3ebb48dcf6b /BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java | |
| parent | 848dc739becfa41193aff9a07c918aed91e5ef79 (diff) | |
Cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java b/BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java index f460941..8807312 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/ListHolder.java @@ -28,8 +28,8 @@ public class ListHolder<ContainedType> implements IHolder<ContainedType> { public ListHolder(ContainedType... values) { heldValues = new FunctionalList<>(); - if(values != null) { - for(ContainedType containedValue : values) { + if (values != null) { + for (ContainedType containedValue : values) { heldValues.add(containedValue); } } @@ -48,7 +48,7 @@ public class ListHolder<ContainedType> implements IHolder<ContainedType> { @Override public <NewType> Function<ContainedType, IHolder<NewType>> lift(Function<ContainedType, NewType> func) { - return (val) -> { + return val -> { return new ListHolder<>(new FunctionalList<>(func.apply(val))); }; } @@ -74,13 +74,7 @@ public class ListHolder<ContainedType> implements IHolder<ContainedType> { @Override public String toString() { - StringBuilder builder = new StringBuilder(); - - builder.append("ListHolder [heldValues="); - builder.append(heldValues); - builder.append("]"); - - return builder.toString(); + return String.format("ListHolder [heldValues=%s]", heldValues); } @Override @@ -95,15 +89,20 @@ public class ListHolder<ContainedType> implements IHolder<ContainedType> { @Override public boolean equals(Object obj) { - if(this == obj) return true; - if(obj == null) return false; - if(getClass() != obj.getClass()) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ListHolder<?>)) + return false; ListHolder<?> other = (ListHolder<?>) obj; - if(heldValues == null) { - if(other.heldValues != null) return false; - } else if(!heldValues.equals(other.heldValues)) return false; + if (heldValues == null) { + if (other.heldValues != null) + return false; + } else if (!heldValues.equals(other.heldValues)) + return false; return true; } |
