Code example for TreeSet

0
/** 
 * Variant on LRUMap which provides an efficient how-many-since-time-T operation. 
 */ 
public class TimeSortedHashtable<T extends Comparable<T>>  {
	public TimeSortedHashtable() { 
		this.elements = new TreeSet<Element<T>>();
		this.valueToElement = new HashMap<T, Element<T>>();
	} 
	 
	private static class Element<T extends Comparable<T>> implements Comparable<Element<T>> {
		Element(long t, T v) {
			time = t;
			value = v;
		} 
		 
		long time;
		final T value;
		 
		@Override 
		public int compareTo(Element<T> o) {
			if(time > o.time) return 1;