package com.leo.ostbm.util;

import java.util.Collection;
import java.util.Map;
import java.util.Set;

public class UnmodifiableMapWrapper<K, V> implements Map<K, V> {
	
	private Map<K, V> wrapped;
	
	public UnmodifiableMapWrapper(Map<K, V> wrapped) {
		this.wrapped = wrapped;
	}

	@Override
	public int size() {
		return wrapped.size();
	}

	@Override
	public boolean isEmpty() {
		return wrapped.isEmpty();
	}

	@Override
	public boolean containsKey(Object key) {
		return wrapped.containsKey(key);
	}

	@Override
	public boolean containsValue(Object value) {
		return wrapped.containsValue(wrapped);
	}

	@Override
	public V get(Object key) {
		return wrapped.get(key);
	}

	@Override
	public V put(K key, V value) {
		return null;
	}

	@Override
	public V remove(Object key) {
		return null;
	}

	@Override
	public void putAll(Map<? extends K, ? extends V> m) {
	}

	@Override
	public void clear() {
	}

	@Override
	public Set<K> keySet() {
		return new UnmodifiableSetWrapper<>(wrapped.keySet());
	}

	@Override
	public Collection<V> values() {
		return new UnmodifiableCollectionWrapper<>(wrapped.values());
	}

	@Override
	public Set<Entry<K, V>> entrySet() {
		return new UnmodifiableSetWrapper<>(wrapped.entrySet());
	}

}

@@ -54,16 +54,43 @@
 ction;%0D%0A
+import java.util.HashSet;%0D%0A
 import j
@@ -195,17 +195,16 @@
 , V%3E %7B%0D%0A
-%09
 %0D%0A%09priva
@@ -226,17 +226,16 @@
 apped;%0D%0A
-%09
 %0D%0A%09publi
@@ -1210,66 +1210,665 @@
 %0D%0A%09@
-Override%0D%0A%09public Set%3CEntry%3CK, V%3E%3E entrySet() %7B%0D%0A%09%09return 
+SuppressWarnings(%22hiding%22)%0D%0A%09public class UnmodifiableEntryWrapper%3CK, V%3E implements Entry%3CK, V%3E %7B%0D%0A%0D%0A%09%09private Entry%3CK, V%3E wrapped;%0D%0A%0D%0A%09%09public UnmodifiableEntryWrapper(Entry%3CK, V%3E wrapped) %7B%0D%0A%09%09%09this.wrapped = wrapped;%0D%0A%09%09%7D%0D%0A%0D%0A%09%09@Override%0D%0A%09%09public K getKey() %7B%0D%0A%09%09%09return wrapped.getKey();%0D%0A%09%09%7D%0D%0A%0D%0A%09%09@Override%0D%0A%09%09public V getValue() %7B%0D%0A%09%09%09return wrapped.getValue();%0D%0A%09%09%7D%0D%0A%0D%0A%09%09@Override%0D%0A%09%09public V setValue(V value) %7B%0D%0A%09%09%09return null;%0D%0A%09%09%7D%0D%0A%0D%0A%09%7D%0D%0A%0D%0A%09@Override%0D%0A%09public Set%3CEntry%3CK, V%3E%3E entrySet() %7B%0D%0A%09%09Set%3CEntry%3CK, V%3E%3E entrySet = wrapped.entrySet();%0D%0A%09%09Set%3CEntry%3CK, V%3E%3E wEntrySet = new HashSet%3C%3E();%0D%0A%09%09for (Entry%3CK, V%3E entry : entrySet)%0D%0A%09%09%09wEntrySet.add(
 new 
@@ -1871,35 +1871,37 @@
 new Unmodifiable
-Set
+Entry
 Wrapper%3C%3E(wrappe
@@ -1898,27 +1898,36 @@
 r%3C%3E(
-wrapped.e
+entry));%0D%0A%09%09return wE
 ntrySet
-())
 ;%0D%0A%09

Make sure map can't be modified via entry.setValue