Code example for ArrayDeque

0
	public static final StaticCall setStartTime = new StaticCall(MaxTimeCache.class, "setStartTime");
 
	private static final ThreadLocal<Deque<Long>> maxTimeCache = new ThreadLocal<Deque<Long>>() {
		@Override 
		protected Deque<Long> initialValue() { 
			return new ArrayDeque<Long>(); 
		} 
	}; 
 
	public static void add() { 
		maxTimeCache.get().addFirst(Long.valueOf(0));
	} 
 
	public static void remove() { 
		maxTimeCache.get().removeFirst();
	} 
 
	public static void setStartTime() { 
		maxTimeCache.get().removeFirst();
		maxTimeCache.get().addFirst(Long.valueOf(System.nanoTime()));
	}