146 |
|
/** |
147 |
|
* Inserts the given element at the beginning of this list. |
148 |
|
* |
149 |
< |
* @param o the element to be inserted at the beginning of this list. |
149 |
> |
* @param e the element to be inserted at the beginning of this list. |
150 |
|
*/ |
151 |
< |
public void addFirst(E o) { |
152 |
< |
addBefore(o, header.next); |
151 |
> |
public void addFirst(E e) { |
152 |
> |
addBefore(e, header.next); |
153 |
|
} |
154 |
|
|
155 |
|
/** |
156 |
|
* Appends the given element to the end of this list. (Identical in |
157 |
|
* function to the <tt>add</tt> method; included only for consistency.) |
158 |
|
* |
159 |
< |
* @param o the element to be inserted at the end of this list. |
159 |
> |
* @param e the element to be inserted at the end of this list. |
160 |
|
*/ |
161 |
< |
public void addLast(E o) { |
162 |
< |
addBefore(o, header); |
161 |
> |
public void addLast(E e) { |
162 |
> |
addBefore(e, header); |
163 |
|
} |
164 |
|
|
165 |
|
/** |
187 |
|
/** |
188 |
|
* Appends the specified element to the end of this list. |
189 |
|
* |
190 |
< |
* @param o element to be appended to this list. |
190 |
> |
* @param e element to be appended to this list. |
191 |
|
* @return <tt>true</tt> (as per the general contract of |
192 |
|
* <tt>Collection.add</tt>). |
193 |
|
*/ |
194 |
< |
public boolean add(E o) { |
195 |
< |
addBefore(o, header); |
194 |
> |
public boolean add(E e) { |
195 |
> |
addBefore(e, header); |
196 |
|
return true; |
197 |
|
} |
198 |
|
|
487 |
|
/** |
488 |
|
* Adds the specified element as the tail (last element) of this list. |
489 |
|
* |
490 |
< |
* @param o the element to add. |
490 |
> |
* @param e the element to add. |
491 |
|
* @return <tt>true</tt> (as per the general contract of |
492 |
|
* <tt>Queue.offer</tt>) |
493 |
|
* @since 1.5 |
494 |
|
*/ |
495 |
< |
public boolean offer(E o) { |
496 |
< |
return add(o); |
495 |
> |
public boolean offer(E e) { |
496 |
> |
return add(e); |
497 |
|
} |
498 |
|
|
499 |
|
// Deque operations |
746 |
|
expectedModCount++; |
747 |
|
} |
748 |
|
|
749 |
< |
public void set(E o) { |
749 |
> |
public void set(E e) { |
750 |
|
if (lastReturned == header) |
751 |
|
throw new IllegalStateException(); |
752 |
|
checkForComodification(); |
753 |
< |
lastReturned.element = o; |
753 |
> |
lastReturned.element = e; |
754 |
|
} |
755 |
|
|
756 |
< |
public void add(E o) { |
756 |
> |
public void add(E e) { |
757 |
|
checkForComodification(); |
758 |
|
lastReturned = header; |
759 |
< |
addBefore(o, next); |
759 |
> |
addBefore(e, next); |
760 |
|
nextIndex++; |
761 |
|
expectedModCount++; |
762 |
|
} |
779 |
|
} |
780 |
|
} |
781 |
|
|
782 |
< |
private Entry<E> addBefore(E o, Entry<E> e) { |
783 |
< |
Entry<E> newEntry = new Entry<E>(o, e, e.previous); |
782 |
> |
private Entry<E> addBefore(E e, Entry<E> entry) { |
783 |
> |
Entry<E> newEntry = new Entry<E>(e, entry, entry.previous); |
784 |
|
newEntry.previous.next = newEntry; |
785 |
|
newEntry.next.previous = newEntry; |
786 |
|
size++; |