917 |
|
} |
918 |
|
|
919 |
|
public void sort(Comparator<? super E> c) { |
920 |
< |
final ReentrantLock lock = this.lock; |
921 |
< |
lock.lock(); |
922 |
< |
try { |
923 |
< |
Object[] elements = getArray(); |
924 |
< |
Object[] newElements = Arrays.copyOf(elements, elements.length); |
925 |
< |
@SuppressWarnings("unchecked") E[] es = (E[])newElements; |
926 |
< |
Arrays.sort(es, c); |
927 |
< |
setArray(newElements); |
920 |
> |
final ReentrantLock lock = this.lock; |
921 |
> |
lock.lock(); |
922 |
> |
try { |
923 |
> |
Object[] elements = getArray(); |
924 |
> |
Object[] newElements = Arrays.copyOf(elements, elements.length); |
925 |
> |
@SuppressWarnings("unchecked") E[] es = (E[])newElements; |
926 |
> |
Arrays.sort(es, c); |
927 |
> |
setArray(newElements); |
928 |
|
} finally { |
929 |
|
lock.unlock(); |
930 |
|
} |