663 |
|
long seq = lock.awaitAvailability(); |
664 |
|
Object[] items = array; |
665 |
|
int n = count; |
666 |
< |
if (n <= items.length) { |
666 |
> |
if (n <= items.length) { |
667 |
|
for (int i = 0; i < n; ++i) { |
668 |
|
Object e = items[i]; |
669 |
|
if (lock.getSequence() != seq) { |
688 |
|
} |
689 |
|
|
690 |
|
public Iterator<E> iterator() { |
691 |
< |
return new Itr(this, 0); |
691 |
> |
return new Itr<E>(this, 0); |
692 |
|
} |
693 |
|
|
694 |
|
public int lastIndexOf(Object o) { |
697 |
|
long seq = lock.awaitAvailability(); |
698 |
|
Object[] items = array; |
699 |
|
int n = count; |
700 |
< |
if (n <= items.length) { |
700 |
> |
if (n <= items.length) { |
701 |
|
for (int i = n - 1; i >= 0; --i) { |
702 |
|
Object e = items[i]; |
703 |
|
if (lock.getSequence() != seq) { |
717 |
|
} |
718 |
|
|
719 |
|
public ListIterator<E> listIterator() { |
720 |
< |
return new Itr(this, 0); |
720 |
> |
return new Itr<E>(this, 0); |
721 |
|
} |
722 |
|
|
723 |
|
public ListIterator<E> listIterator(int index) { |
724 |
< |
return new Itr(this, index); |
724 |
> |
return new Itr<E>(this, index); |
725 |
|
} |
726 |
|
|
727 |
|
public E remove(int index) { |
784 |
|
int ssize = toIndex - fromIndex; |
785 |
|
if (fromIndex < 0 || toIndex > c || ssize < 0) |
786 |
|
throw new IndexOutOfBoundsException(); |
787 |
< |
return new ReadMostlyVectorSublist(this, fromIndex, ssize); |
787 |
> |
return new ReadMostlyVectorSublist<E>(this, fromIndex, ssize); |
788 |
|
} |
789 |
|
|
790 |
|
public Object[] toArray() { |
805 |
|
* Append the element if not present. |
806 |
|
* |
807 |
|
* @param e element to be added to this list, if absent |
808 |
< |
* @return <tt>true</tt> if the element was added |
808 |
> |
* @return {@code true} if the element was added |
809 |
|
*/ |
810 |
|
public boolean addIfAbsent(E e) { |
811 |
|
boolean added; |
860 |
|
* Returns an iterator operating over a snapshot copy of the |
861 |
|
* elements of this collection created upon construction of the |
862 |
|
* iterator. The iterator does <em>NOT</em> support the |
863 |
< |
* <tt>remove</tt> method. |
863 |
> |
* {@code remove} method. |
864 |
|
* |
865 |
|
* @return an iterator over the elements in this list in proper sequence |
866 |
|
*/ |
1060 |
|
|
1061 |
|
/** See {@link Vector#elements} */ |
1062 |
|
public Enumeration<E> elements() { |
1063 |
< |
return new Itr(this, 0); |
1063 |
> |
return new Itr<E>(this, 0); |
1064 |
|
} |
1065 |
|
|
1066 |
|
/** See {@link Vector#capacity} */ |
1106 |
|
|
1107 |
|
// other methods |
1108 |
|
|
1109 |
< |
public Object clone() { |
1109 |
> |
public ReadMostlyVector<E> clone() { |
1110 |
|
SequenceLock lock = this.lock; |
1111 |
|
Object[] a = null; |
1112 |
|
boolean retry = false; |
1126 |
|
lock.unlock(); |
1127 |
|
} |
1128 |
|
} |
1129 |
< |
return new ReadMostlyVector(a, n, capacityIncrement); |
1129 |
> |
return new ReadMostlyVector<E>(a, n, capacityIncrement); |
1130 |
|
} |
1131 |
|
|
1132 |
|
private void writeObject(java.io.ObjectOutputStream s) |
1416 |
|
} |
1417 |
|
|
1418 |
|
public Iterator<E> iterator() { |
1419 |
< |
return new SubItr(this, offset); |
1419 |
> |
return new SubItr<E>(this, offset); |
1420 |
|
} |
1421 |
|
|
1422 |
|
public int lastIndexOf(Object o) { |
1440 |
|
} |
1441 |
|
|
1442 |
|
public ListIterator<E> listIterator() { |
1443 |
< |
return new SubItr(this, offset); |
1443 |
> |
return new SubItr<E>(this, offset); |
1444 |
|
} |
1445 |
|
|
1446 |
|
public ListIterator<E> listIterator(int index) { |
1447 |
< |
return new SubItr(this, index + offset); |
1447 |
> |
return new SubItr<E>(this, index + offset); |
1448 |
|
} |
1449 |
|
|
1450 |
|
public E remove(int index) { |
1504 |
|
int ssize = toIndex - fromIndex; |
1505 |
|
if (fromIndex < 0 || toIndex > c || ssize < 0) |
1506 |
|
throw new IndexOutOfBoundsException(); |
1507 |
< |
return new ReadMostlyVectorSublist(list, offset+fromIndex, ssize); |
1507 |
> |
return new ReadMostlyVectorSublist<E>(list, offset+fromIndex, ssize); |
1508 |
|
} |
1509 |
|
|
1510 |
|
public Object[] toArray() { |