332 |
|
* @return the first element of this deque |
333 |
|
* @throws NoSuchElementException if this deque is empty |
334 |
|
*/ |
335 |
< |
public E firstElement() { |
335 |
> |
public E getFirst() { |
336 |
|
E x = elements[head]; |
337 |
|
if (x == null) |
338 |
|
throw new NoSuchElementException(); |
347 |
|
* @return the last element of this deque |
348 |
|
* @throws NoSuchElementException if this deque is empty |
349 |
|
*/ |
350 |
< |
public E lastElement() { |
350 |
> |
public E getLast() { |
351 |
|
E x = elements[(tail - 1) & (elements.length - 1)]; |
352 |
|
if (x == null) |
353 |
|
throw new NoSuchElementException(); |
478 |
|
* this deque. This method differs from the <tt>peek</tt> method only in |
479 |
|
* that it throws an exception if this deque is empty. |
480 |
|
* |
481 |
< |
* <p>This method is equivalent to {@link #firstElement} |
481 |
> |
* <p>This method is equivalent to {@link #getFirst} |
482 |
|
* |
483 |
|
* @return the head of the queue represented by this deque |
484 |
|
* @throws NoSuchElementException if this deque is empty |
485 |
|
*/ |
486 |
|
public E element() { |
487 |
< |
return firstElement(); |
487 |
> |
return getFirst(); |
488 |
|
} |
489 |
|
|
490 |
|
// *** Stack methods *** |