com.rapiddweller.common.collection.MapProxy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of rd-lib-common Show documentation
Show all versions of rd-lib-common Show documentation
'rapiddweller Common' is an open source Java library
forked from Databene Commons by Volker Bergmann.
It provides extensions to the Java core library by utility classes, abstract concepts
and concrete implementations.
/*
* Copyright (C) 2004-2015 Volker Bergmann ([email protected]).
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.rapiddweller.common.collection;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/**
* Proxy class for a {@link Map}.
* Created: 12.12.2012 11:49:35
*
* @param The type of map to wrap
* @param the key type
* @param the value type
* @author Volker Bergmann
* @since 0.5.21
*/
public class MapProxy, K, V> implements Map {
/**
* The Real map.
*/
protected final M realMap;
/**
* Instantiates a new Map proxy.
*
* @param realMap the real map
*/
protected MapProxy(M realMap) {
this.realMap = realMap;
}
/**
* Gets real map.
*
* @return the real map
*/
public Object getRealMap() {
return realMap;
}
@Override
public void clear() {
realMap.clear();
}
@Override
public boolean containsKey(Object key) {
return realMap.containsKey(key);
}
@Override
public boolean containsValue(Object value) {
return realMap.containsValue(value);
}
@Override
public Set> entrySet() {
return realMap.entrySet();
}
@Override
public V get(Object key) {
return realMap.get(key);
}
@Override
public boolean isEmpty() {
return realMap.isEmpty();
}
@Override
public Set keySet() {
return realMap.keySet();
}
@Override
public V put(K key, V value) {
return realMap.put(key, value);
}
@Override
public void putAll(Map extends K, ? extends V> m) {
realMap.putAll(m);
}
@Override
public V remove(Object key) {
return realMap.remove(key);
}
@Override
public int size() {
return realMap.size();
}
@Override
public Collection values() {
return realMap.values();
}
// java.lang.Object overrides --------------------------------------------------------------------------------------
@Override
public int hashCode() {
return realMap.hashCode();
}
@Override
public boolean equals(Object o) {
return realMap.equals(o);
}
@Override
public String toString() {
return realMap.toString();
}
}