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 --- src/main/java/bjc/funcdata/ExtendedMap.java | 50 ++++++++++++++++++----------- 1 file changed, 31 insertions(+), 19 deletions(-) (limited to 'src/main/java/bjc/funcdata/ExtendedMap.java') diff --git a/src/main/java/bjc/funcdata/ExtendedMap.java b/src/main/java/bjc/funcdata/ExtendedMap.java index 76fac01..bd500f4 100644 --- a/src/main/java/bjc/funcdata/ExtendedMap.java +++ b/src/main/java/bjc/funcdata/ExtendedMap.java @@ -11,10 +11,10 @@ import java.util.function.Function; * @author Ben Culkin * * @param - * The type of the keys of the map. + * The type of the keys of the map. * * @param - * The type of the values of the map. + * The type of the values of the map. */ class ExtendedMap implements IMap { /* The map we delegate lookups to. */ @@ -26,12 +26,13 @@ class ExtendedMap implements IMap { * Create a new extended map. * * @param delegate - * The map to lookup things in. - * + * The map to lookup things in. + * * @param store - * The map to store things in. + * The map to store things in. */ - public ExtendedMap(final IMap delegate, final IMap store) { + public ExtendedMap(final IMap delegate, + final IMap store) { this.delegate = delegate; this.store = store; } @@ -43,7 +44,8 @@ class ExtendedMap implements IMap { @Override public boolean containsKey(final KeyType key) { - if(store.containsKey(key)) return true; + if (store.containsKey(key)) + return true; return delegate.containsKey(key); } @@ -76,7 +78,8 @@ class ExtendedMap implements IMap { @Override public ValueType get(final KeyType key) { - if(store.containsKey(key)) return store.get(key); + if (store.containsKey(key)) + return store.get(key); return delegate.get(key); } @@ -97,7 +100,8 @@ class ExtendedMap implements IMap { } @Override - public IMap transform(final Function transformer) { + public IMap + transform(final Function transformer) { return new TransformedValueMap<>(this, transformer); } @@ -108,7 +112,8 @@ class ExtendedMap implements IMap { @Override public ValueType remove(final KeyType key) { - if(!store.containsKey(key)) return delegate.remove(key); + if (!store.containsKey(key)) + return delegate.remove(key); return store.remove(key); } @@ -134,18 +139,25 @@ class ExtendedMap implements IMap { @Override public boolean equals(final Object obj) { - if(this == obj) return true; - if(obj == null) return false; - if(!(obj instanceof ExtendedMap)) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof ExtendedMap)) + return false; final ExtendedMap other = (ExtendedMap) obj; - if(delegate == null) { - if(other.delegate != null) return false; - } else if(!delegate.equals(other.delegate)) return false; - if(store == null) { - if(other.store != null) return false; - } else if(!store.equals(other.store)) return false; + if (delegate == null) { + if (other.delegate != null) + return false; + } else if (!delegate.equals(other.delegate)) + return false; + if (store == null) { + if (other.store != null) + return false; + } else if (!store.equals(other.store)) + return false; return true; } -- cgit v1.2.3