All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.leopard.burrow.lang.SynchronizedLRUMap Maven / Gradle / Ivy

package io.leopard.burrow.lang;

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

import org.apache.commons.collections.map.LRUMap;

public class SynchronizedLRUMap implements Map {

	private Map map;

	@SuppressWarnings("unchecked")
	public SynchronizedLRUMap(int initialEntries, int maxEntries) {
		this.map = Collections.synchronizedMap(new LRUMap(maxEntries));
	}

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

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

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

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

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

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

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

	@Override
	public void putAll(Map m) {
		map.putAll(m);
	}

	@Override
	public void clear() {
		map.clear();
	}

	@Override
	public Set keySet() {
		return map.keySet();
	}

	@Override
	public Collection values() {
		return map.values();
	}

	@Override
	public Set> entrySet() {
		return map.entrySet();
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy