/** * Returns the first (longest-waiting) thread in the queue, or {@code null} if * no threads are currently queued. * * <p> * In this implementation, this operation normally returns in constant time, * but may iterate upon contention if other threads are concurrently modifying * the queue. * * @return the first (longest-waiting) thread in the queue, or {@code null} if * no threads are currently queued */ public final Thread getFirstQueuedThread() { // handle only fast path, else relay return (head == tail) ? null : fullGetFirstQueuedThread(); }