package railo.commons.collection;

import java.util.LinkedHashMap;

public class LinkedHashMapMaxSize<K, V> extends LinkedHashMap<K, V> {
	
	private int maxSize;

	public LinkedHashMapMaxSize(int maxSize){
		this.maxSize=maxSize;
	}

	@Override
	protected boolean removeEldestEntry(java.util.Map.Entry<K, V> eldest) {
		return size() > maxSize;
	}
}

@@ -200,33 +200,227 @@
 Size
-)%7B%0A%09%09this.maxSize=maxSize
+, int initCapacity, boolean accessOrder) %7B%0A%09%09super( initCapacity, 0.75f, accessOrder );%0A%09%09this.maxSize=maxSize;%0A%09%7D%0A%0A%09public LinkedHashMapMaxSize(int maxSize) %7B%0A%09%09this( maxSize, (int)Math.ceil( maxSize / 0.75f ), false )
 ;%0A%09%7D

set initCapacity instead of default 16 for performance