Code example for Deque

Methods: addFirst

0
			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()));
	} 
 
	public static boolean isWithinMaxTime(double seconds) {
		long endTime = System.nanoTime();
		long startTime = maxTimeCache.get().getFirst();
		return ((double) (endTime - startTime)) / 1000000000 <= seconds;