private Lock queueLock = new ReentrantLock();private Condition spaceAvailableCondition = queueLock.newCondition();
public void add(E newValue){ . . . while (size == elements.length) spaceAvailableCondition.await(); . . .}