From c82e3b3b2de0633317ec8fc85925e91422820597 Mon Sep 17 00:00:00 2001 From: "Benjamin J. Culkin" Date: Sun, 8 Oct 2017 22:39:59 -0300 Subject: Start splitting into maven modules --- .../main/java/bjc/utils/funcdata/ExtendedMap.java | 127 --------------------- 1 file changed, 127 deletions(-) delete mode 100644 BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java (limited to 'BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java b/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java deleted file mode 100644 index 909c5e9..0000000 --- a/BJC-Utils2/src/main/java/bjc/utils/funcdata/ExtendedMap.java +++ /dev/null @@ -1,127 +0,0 @@ -package bjc.utils.funcdata; - -import java.util.function.BiConsumer; -import java.util.function.Consumer; -import java.util.function.Function; - -import bjc.utils.funcutils.ListUtils; - -class ExtendedMap implements IMap { - private final IMap delegate; - - private final IMap store; - - public ExtendedMap(final IMap delegate, final IMap store) { - this.delegate = delegate; - this.store = store; - } - - @Override - public void clear() { - store.clear(); - } - - @Override - public boolean containsKey(final KeyType key) { - if (store.containsKey(key)) return true; - - return delegate.containsKey(key); - } - - @Override - public IMap extend() { - return new ExtendedMap<>(this, new FunctionalMap<>()); - } - - @Override - public void forEach(final BiConsumer action) { - store.forEach(action); - - delegate.forEach(action); - } - - @Override - public void forEachKey(final Consumer action) { - store.forEachKey(action); - - delegate.forEachKey(action); - } - - @Override - public void forEachValue(final Consumer action) { - store.forEachValue(action); - - delegate.forEachValue(action); - } - - @Override - public ValueType get(final KeyType key) { - if (store.containsKey(key)) return store.get(key); - - return delegate.get(key); - } - - @Override - public int size() { - return store.size() + delegate.size(); - } - - @Override - public IList keyList() { - return ListUtils.mergeLists(store.keyList(), delegate.keyList()); - } - - @Override - public IMap transform(final Function transformer) { - return new TransformedValueMap<>(this, transformer); - } - - @Override - public ValueType put(final KeyType key, final ValueType val) { - return store.put(key, val); - } - - @Override - public ValueType remove(final KeyType key) { - if (!store.containsKey(key)) return delegate.remove(key); - - return store.remove(key); - } - - @Override - public IList valueList() { - return ListUtils.mergeLists(store.valueList(), delegate.valueList()); - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + (delegate == null ? 0 : delegate.hashCode()); - result = prime * result + (store == null ? 0 : store.hashCode()); - return result; - } - - @Override - public boolean equals(final Object obj) { - 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; - - return true; - } - - @Override - public String toString() { - return String.format("ExtendedMap [delegate=%s, store=%s]", delegate, store); - } -} -- cgit v1.2.3