You can anonymously extend LinkedHashMap to change the removeEldestEntry(...) behavior, and then transfer the instance of the anonymous class to the synchronized map. You did not specify what type parameters you need, so I use <String, Integer> in this example.
Map<String, Integer> map = Collections.synchronizedMap(new LinkedHashMap<String, Integer>() { private static final long serialVersionUID = 12345L;
Kevin krumwiede
source share