Code example for Deque

Methods: removeFirst

0
	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;
	} 
} 
Contextual code suggestions in your IDE  Get Codota for Java