Code example for TreeSet

 * 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;
		public int compareTo(Element<T> o) {
Connect your IDE to all the code out there  Get Codota for Java